Examples: swap magic numbers for EXIT_ codes #1618

pull Cheapshot003 wants to merge 1 commits into bitcoin-core:master from Cheapshot003:#1609-EXIT_codes_instead_of_magic_numbers changing 5 files +49 −44
  1. Cheapshot003 commented at 12:26 pm on October 15, 2024: contributor

    As discussed in #1609 this PR will use EXIT_{success, failure} codes instead of magic numbers in the return statements.

    If it looks good I will continue to remove the asserts too in another commit.

  2. #1609-swap magic numbers for exit codes in examples b70d3e6cde
  3. real-or-random commented at 2:03 pm on October 15, 2024: contributor

    If it looks good I will continue to remove the asserts too in another commit.

    It looks good in principle. But your PR already needs to be rebased now. (Did you accidentally build on an outdated version of master?)

  4. real-or-random added the label user-documentation on Oct 15, 2024
  5. real-or-random added the label refactor/smell on Oct 15, 2024
  6. real-or-random renamed this:
    Examples: swap magic numbers for EXIT_ codes#1609-swap magic numbers for exit codes in examples
    Examples: swap magic numbers for EXIT_ codes
    on Oct 15, 2024
  7. in examples/musig.c:74 in b70d3e6cde
    70@@ -70,7 +71,7 @@ static int tweak(const secp256k1_context* ctx, secp256k1_xonly_pubkey *agg_pk, s
    71     /* Plain tweaking which, for example, allows deriving multiple child
    72      * public keys from a single aggregate key using BIP32 */
    73     if (!secp256k1_musig_pubkey_ec_tweak_add(ctx, NULL, cache, plain_tweak)) {
    74-        return 0;
    75+        return EXIT_FAILURE;
    


    theStack commented at 4:02 pm on October 15, 2024:
    note that the EXIT_... constants are only meant to be used for program termination (i.e. to be returned from main, or as argument to exit(...)), not as return codes in our own functions (in this case tweak(...))
  8. high089123 approved

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-03 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me