bio: remove reference count.

It appears that this reference “count” is set to one at creation and
never touched after that.

Change-Id: I3238a6d3dd702953771b8ec725c1c5712c648fba
Reviewed-on: https://boringssl-review.googlesource.com/4320
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2015-04-13 11:04:03 -07:00
parent 1f26ed767a
commit 9bde6aeb76
2 changed files with 1 additions and 10 deletions

View File

@ -75,7 +75,6 @@ static int bio_set(BIO *bio, const BIO_METHOD *method) {
bio->method = method;
bio->shutdown = 1;
bio->references = 1;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data)) {
return 0;
@ -110,11 +109,6 @@ int BIO_free(BIO *bio) {
BIO *next_bio;
for (; bio != NULL; bio = next_bio) {
int refs = CRYPTO_add(&bio->references, -1, CRYPTO_LOCK_BIO);
if (refs > 0) {
return 0;
}
if (bio->callback != NULL) {
int i = (int)bio->callback(bio, BIO_CB_FREE, NULL, 0, 0, 1);
if (i <= 0) {

View File

@ -783,10 +783,7 @@ struct bio_st {
/* num is a BIO-specific value. For example, in fd BIOs it's used to store a
* file descriptor. */
int num;
/* TODO(fork): reference counting is only used by the SSL BIO code. If we can
* dump that then we can remove this. We could also drop
* BIO_CTRL_PUSH/BIO_CTRL_POP. */
int references;
/* TODO(fork): drop BIO_CTRL_PUSH/BIO_CTRL_POP. */
void *ptr;
/* next_bio points to the next |BIO| in a chain. This |BIO| owns a reference
* to |next_bio|. */