提交 152d2646 编写于 作者: M mrpre 提交者: Rich Salz
上级 0a1d3a81
...@@ -72,17 +72,11 @@ void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data) ...@@ -72,17 +72,11 @@ void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
unsigned long hash; unsigned long hash;
OPENSSL_LH_NODE *nn, **rn; OPENSSL_LH_NODE *nn, **rn;
void *ret; void *ret;
int val = 0;
lh->error = 0; lh->error = 0;
if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
val = expand(lh); return NULL; /* 'lh->error++' already done in 'expand' */
if(val){
lh->error++;
return (NULL);
}
rn = getrn(lh, data, &hash); rn = getrn(lh, data, &hash);
if (*rn == NULL) { if (*rn == NULL) {
...@@ -222,7 +216,7 @@ static int expand(OPENSSL_LHASH *lh) ...@@ -222,7 +216,7 @@ static int expand(OPENSSL_LHASH *lh)
/* fputs("realloc error in lhash",stderr); */ /* fputs("realloc error in lhash",stderr); */
lh->error++; lh->error++;
lh->p = 0; lh->p = 0;
return -1; return 0;
} }
for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */ for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */
n[i] = NULL; /* 02/03/92 eay */ n[i] = NULL; /* 02/03/92 eay */
...@@ -232,7 +226,7 @@ static int expand(OPENSSL_LHASH *lh) ...@@ -232,7 +226,7 @@ static int expand(OPENSSL_LHASH *lh)
lh->p = 0; lh->p = 0;
lh->b = n; lh->b = n;
} }
return 0; return 1;
} }
static void contract(OPENSSL_LHASH *lh) static void contract(OPENSSL_LHASH *lh)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册