mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-30 07:47:36 +01:00
fac30eec42refactor: Replace &foo[0] with foo.data() (MarcoFalke)faece47c47refactor: Avoid &foo[0] on C-Style arrays (MarcoFalke)face961109refactor: Use only one temporary buffer in CreateObfuscateKey (MarcoFalke)fa05dddc42refactor: Use CPubKey vector constructor where possible (MarcoFalke)fabb6dfe6escript: 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 commit592404f03f, and https://github.com/bitcoin/bitcoin/pull/9804 ACKs for top commit: laanwj: Code review ACKfac30eec42practicalswift: cr ACKfac30eec42: patch looks correct promag: Code review ACKfac30eec42. Tree-SHA512: e7e73146edbc78911a8e8c728b0a1c6b0ed9a88a008e650aa5dbffe72425bd42c76df70199a9cf7e02637448d7593e0eac52fd0f91f59240283e1390ee21bfa5