Avoid needless C gymnastics.

This can just be a bog-standard loop. The compiler should be plenty
smart enough to transform it into whatever it likes.

Change-Id: I7b782dd2a11902f6e5c9902d9624be26eee5c959
Reviewed-on: https://boringssl-review.googlesource.com/15366
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2017-04-21 11:33:15 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent 1997ef22d7
commit 02ba1789a3

View File

@ -242,13 +242,8 @@ static void BN_POOL_init(BN_POOL *p) {
static void BN_POOL_finish(BN_POOL *p) {
while (p->head) {
unsigned int loop = 0;
BIGNUM *bn = p->head->vals;
while (loop++ < BN_CTX_POOL_SIZE) {
if (bn->d) {
BN_clear_free(bn);
}
bn++;
for (size_t i = 0; i < BN_CTX_POOL_SIZE; i++) {
BN_clear_free(&p->head->vals[i]);
}
p->current = p->head->next;
@ -259,17 +254,14 @@ static void BN_POOL_finish(BN_POOL *p) {
static BIGNUM *BN_POOL_get(BN_POOL *p) {
if (p->used == p->size) {
BIGNUM *bn;
unsigned int loop = 0;
BN_POOL_ITEM *item = OPENSSL_malloc(sizeof(BN_POOL_ITEM));
if (!item) {
return NULL;
}
/* Initialise the structure */
bn = item->vals;
while (loop++ < BN_CTX_POOL_SIZE) {
BN_init(bn++);
for (size_t i = 0; i < BN_CTX_POOL_SIZE; i++) {
BN_init(&item->vals[i]);
}
item->prev = p->tail;