Merge bitcoin-core/secp256k1#1824: util: introduce and use ARRAY_SIZE macro
921b9711eautil: introduce and use `ARRAY_SIZE` macro (Sebastian Falbesoner) Pull request description: This PR is another tiny improvement found while working on #1765, with the goal to avoid code repetition. The `ARRAY_SIZE` macro definition is pretty wide-spread in C projects and e.g. matches the one [used in the Linux Kernel](9702969978/include/linux/array_size.h (L11)) (without the additional check to reject pointers, as we would need GNU C for that, see e.g. https://stackoverflow.com/a/19455169; not sure if a useful counterpart exists that only relies on C89). Replacement instances were identified via `$ git grep sizeof.*/.*sizeof`. ACKs for top commit: w0xlt: ACK921b9711eareal-or-random: utACK921b9711eaTree-SHA512: 44b6bf0132cf00fade526a3fc04e03dc896d04874123614c032206b61f97c81f94d139b6cc0c108eceaa699251580c19420d230b3150607303ca2cb7ab9a0bcb
This commit is contained in:
@@ -183,8 +183,7 @@ int main(int argc, char** argv) {
|
||||
"ecdsa_recover", "schnorrsig", "schnorrsig_verify", "schnorrsig_sign", "ec",
|
||||
"keygen", "ec_keygen", "ellswift", "encode", "ellswift_encode", "decode",
|
||||
"ellswift_decode", "ellswift_keygen", "ellswift_ecdh"};
|
||||
size_t valid_args_size = sizeof(valid_args)/sizeof(valid_args[0]);
|
||||
int invalid_args = have_invalid_args(argc, argv, valid_args, valid_args_size);
|
||||
int invalid_args = have_invalid_args(argc, argv, valid_args, ARRAY_SIZE(valid_args));
|
||||
|
||||
int default_iters = 20000;
|
||||
int iters = get_iters(default_iters);
|
||||
|
||||
Reference in New Issue
Block a user