Merge bitcoin-core/secp256k1#1784: refactor: remove ret from secp256k1_ec_pubkey_serialize

3daab83a60 refactor: remove ret from secp256k1_ec_pubkey_serialize (kevkevinpal)

Pull request description:

  This is a follow-up to https://github.com/bitcoin-core/secp256k1/pull/1774#discussion_r2539737079

  It is pretty straightforward to remove `ret` and to just return either `0` or `1`

ACKs for top commit:
  real-or-random:
    utACK 3daab83a60
  theStack:
    ACK 3daab83a60

Tree-SHA512: ce598d917455a2d25297436bf2b900a9e88a638617cb79ca22e467135035c334b6815911fe4429ff44dbd877e6d10a346d0b37f2e5a7459e5b35854023832d27
This commit is contained in:
merge-script
2025-12-10 16:13:24 +01:00

View File

@@ -268,7 +268,6 @@ int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pu
int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_pubkey* pubkey, unsigned int flags) { int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_pubkey* pubkey, unsigned int flags) {
secp256k1_ge Q; secp256k1_ge Q;
size_t len; size_t len;
int ret = 0;
VERIFY_CHECK(ctx != NULL); VERIFY_CHECK(ctx != NULL);
ARG_CHECK(outputlen != NULL); ARG_CHECK(outputlen != NULL);
@@ -287,9 +286,9 @@ int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *o
secp256k1_eckey_pubkey_serialize65(&Q, output); secp256k1_eckey_pubkey_serialize65(&Q, output);
*outputlen = 65; *outputlen = 65;
} }
ret = 1; return 1;
} }
return ret; return 0;
} }
int secp256k1_ec_pubkey_cmp(const secp256k1_context* ctx, const secp256k1_pubkey* pubkey0, const secp256k1_pubkey* pubkey1) { int secp256k1_ec_pubkey_cmp(const secp256k1_context* ctx, const secp256k1_pubkey* pubkey0, const secp256k1_pubkey* pubkey1) {