Merge bitcoin/bitcoin#21817: refactor: Replace &foo[0] with foo.data()

Merge bitcoin/bitcoin#21817: refactor: Replace &foo[0] with foo.data()

fac30eec42c486ec1bfd696293040a7aa0f04625 refactor: Replace &foo[0] with foo.data() (MarcoFalke)
faece47c4706783e0460ed977390a44630b2d44c refactor: Avoid &foo[0] on C-Style arrays (MarcoFalke)
face9611093377e8502d91f2ff56f9319a56357c refactor: Use only one temporary buffer in CreateObfuscateKey (MarcoFalke)
fa05dddc42770809fdae4d9c35155f8117960019 refactor: Use CPubKey vector constructor where possible (MarcoFalke)
fabb6dfe6e734eadd91448122f2ce8c1612c39a6 script: Replace address-of idiom with vector data() method (Guido Vranken)

Pull request description:

  The main theme of this refactor is to replace `&foo[0]` with `foo.data()`.

  The first commit is taken from #21781 with the rationale:

  * In CSignatureCache::ComputeEntryECDSA, change the way a vector pointer is resolved to prevent invoking undefined behavior if the vector is empty.

  The other commits aim to remove all `&foo[0]`, where `foo` is any kind of byte representation. The rationale:

  * Sometimes alternative code without any raw data pointers is easier to read (refer to the respective commit message for details)
  * If the raw data pointer is needed, `foo.data()` should be preferred, as pointed out in the developer notes. This addresses the instances that have been missed in commit 592404f03f2b734351d734f0c9ca1fdce997321b, and https://github.com/bitcoin/bitcoin/pull/9804

ACKs for top commit:
  laanwj:
    Code review ACK fac30eec42c486ec1bfd696293040a7aa0f04625
  practicalswift:
    cr ACK fac30eec42c486ec1bfd696293040a7aa0f04625: patch looks correct
  promag:
    Code review ACK fac30eec42c486ec1bfd696293040a7aa0f04625.

Tree-SHA512: e7e73146edbc78911a8e8c728b0a1c6b0ed9a88a008e650aa5dbffe72425bd42c76df70199a9cf7e02637448d7593e0eac52fd0f91f59240283e1390ee21bfa5

情報元 - Merge bitcoin/bitcoin#21817: refactor: Replace &foo[0] with foo.data() · bitcoin/[email protected] · GitHub

Merge bitcoin/bitcoin#21817: refactor: Replace &foo[0] with foo.data() · bitcoin/bitcoin@32f1f02 · GitHub
スポンサーリンク

シェアする

フォローする

スポンサーリンク

トップへ戻る