diff options
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio_lcl.h | 3 | ||||
-rw-r--r-- | crypto/bio/bio_lib.c | 4 | ||||
-rw-r--r-- | crypto/bio/bio_meth.c | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/crypto/bio/bio_lcl.h b/crypto/bio/bio_lcl.h index d46f4e745c..f7de429cbb 100644 --- a/crypto/bio/bio_lcl.h +++ b/crypto/bio/bio_lcl.h @@ -9,6 +9,7 @@ #define USE_SOCKETS #include "e_os.h" +#include "internal/refcount.h" /* BEGIN BIO_ADDRINFO/BIO_ADDR stuff. */ @@ -125,7 +126,7 @@ struct bio_st { void *ptr; struct bio_st *next_bio; /* used by filter BIOs */ struct bio_st *prev_bio; /* used by filter BIOs */ - int references; + CRYPTO_REF_COUNT references; uint64_t num_read; uint64_t num_write; CRYPTO_EX_DATA ex_data; diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index c14e238ddc..4c2af7d746 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -113,7 +113,7 @@ int BIO_free(BIO *a) if (a == NULL) return 0; - if (CRYPTO_atomic_add(&a->references, -1, &ret, a->lock) <= 0) + if (CRYPTO_DOWN_REF(&a->references, &ret, a->lock) <= 0) return 0; REF_PRINT_COUNT("BIO", a); @@ -178,7 +178,7 @@ int BIO_up_ref(BIO *a) { int i; - if (CRYPTO_atomic_add(&a->references, 1, &i, a->lock) <= 0) + if (CRYPTO_UP_REF(&a->references, &i, a->lock) <= 0) return 0; REF_PRINT_COUNT("BIO", a); diff --git a/crypto/bio/bio_meth.c b/crypto/bio/bio_meth.c index 588c5170f7..3cbac5bf85 100644 --- a/crypto/bio/bio_meth.c +++ b/crypto/bio/bio_meth.c @@ -21,14 +21,14 @@ DEFINE_RUN_ONCE_STATIC(do_bio_type_init) int BIO_get_new_index() { - static int bio_count = BIO_TYPE_START; + static CRYPTO_REF_COUNT bio_count = BIO_TYPE_START; int newval; if (!RUN_ONCE(&bio_type_init, do_bio_type_init)) { BIOerr(BIO_F_BIO_GET_NEW_INDEX, ERR_R_MALLOC_FAILURE); return -1; } - if (!CRYPTO_atomic_add(&bio_count, 1, &newval, bio_type_lock)) + if (!CRYPTO_UP_REF(&bio_count, &newval, bio_type_lock)) return -1; return newval; } |