No need for an inconsistently named local variable and a ternary operator.
ok jsing
-/* $OpenBSD: bio_lib.c,v 1.52 2024/03/02 09:22:41 tb Exp $ */
+/* $OpenBSD: bio_lib.c,v 1.53 2024/03/27 01:22:30 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int
BIO_up_ref(BIO *bio)
{
- int refs = CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO);
- return (refs > 1) ? 1 : 0;
+ return CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO) > 1;
}
LCRYPTO_ALIAS(BIO_up_ref);
-/* $OpenBSD: dh_lib.c,v 1.43 2023/11/29 21:35:57 tb Exp $ */
+/* $OpenBSD: dh_lib.c,v 1.44 2024/03/27 01:22:30 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int
DH_up_ref(DH *r)
{
- int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DH);
-
- return i > 1 ? 1 : 0;
+ return CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DH) > 1;
}
LCRYPTO_ALIAS(DH_up_ref);
-/* $OpenBSD: dsa_lib.c,v 1.46 2023/11/29 21:35:57 tb Exp $ */
+/* $OpenBSD: dsa_lib.c,v 1.47 2024/03/27 01:22:30 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int
DSA_up_ref(DSA *r)
{
- int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA);
- return i > 1 ? 1 : 0;
+ return CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA) > 1;
}
LCRYPTO_ALIAS(DSA_up_ref);
-/* $OpenBSD: ec_key.c,v 1.39 2023/11/29 21:35:57 tb Exp $ */
+/* $OpenBSD: ec_key.c,v 1.40 2024/03/27 01:22:30 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
int
EC_KEY_up_ref(EC_KEY *r)
{
- int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC);
- return ((i > 1) ? 1 : 0);
+ return CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC) > 1;
}
LCRYPTO_ALIAS(EC_KEY_up_ref);
-/* $OpenBSD: rsa_lib.c,v 1.49 2023/11/19 15:46:10 tb Exp $ */
+/* $OpenBSD: rsa_lib.c,v 1.50 2024/03/27 01:22:30 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int
RSA_up_ref(RSA *r)
{
- int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
- return i > 1 ? 1 : 0;
+ return CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA) > 1;
}
LCRYPTO_ALIAS(RSA_up_ref);
-/* $OpenBSD: x_all.c,v 1.30 2023/02/16 08:38:17 tb Exp $ */
+/* $OpenBSD: x_all.c,v 1.31 2024/03/27 01:22:30 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int
X509_up_ref(X509 *x)
{
- int i = CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
- return i > 1 ? 1 : 0;
+ return CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509) > 1;
}
LCRYPTO_ALIAS(X509_up_ref);