summaryrefslogtreecommitdiff
path: root/crypto/lhash
diff options
context:
space:
mode:
authormrpre <mrpre@163.com>2016-07-01 08:55:18 +0800
committerRich Salz <rsalz@openssl.org>2016-07-01 10:56:19 -0400
commit152d26461609ae36f329d6f48b2d0749e43834f3 (patch)
tree0c878d4753ad7b434aaeddd638127ebb52d99acf /crypto/lhash
parent0a1d3a8152ffb96d42e56c3c1f04eb14a45e66aa (diff)
downloadopenssl-new-152d26461609ae36f329d6f48b2d0749e43834f3.tar.gz
fix code formatting
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1223)
Diffstat (limited to 'crypto/lhash')
-rw-r--r--crypto/lhash/lhash.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c
index 1ca4289e05..19c6d2c31d 100644
--- a/crypto/lhash/lhash.c
+++ b/crypto/lhash/lhash.c
@@ -72,17 +72,11 @@ void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
- int val = 0;
-
+
lh->error = 0;
- if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))
- val = expand(lh);
-
- if(val){
- lh->error++;
- return (NULL);
- }
-
+ if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
+ return NULL; /* 'lh->error++' already done in 'expand' */
+
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
@@ -222,7 +216,7 @@ static int expand(OPENSSL_LHASH *lh)
/* fputs("realloc error in lhash",stderr); */
lh->error++;
lh->p = 0;
- return -1;
+ return 0;
}
for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */
n[i] = NULL; /* 02/03/92 eay */
@@ -232,7 +226,7 @@ static int expand(OPENSSL_LHASH *lh)
lh->p = 0;
lh->b = n;
}
- return 0;
+ return 1;
}
static void contract(OPENSSL_LHASH *lh)