summaryrefslogtreecommitdiffstats
path: root/crypto/lhash
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-09-03 09:15:26 -0400
committerRich Salz <rsalz@openssl.org>2015-09-03 16:26:34 -0400
commit64b25758edca688a30f02c260262150f7ad0bc7d (patch)
tree15ad5a8c7985e2b27aaf7a14737fd980a36349dd /crypto/lhash
parentfb4844bbc62fb014c115cd8fd2fc4304cba6eb89 (diff)
remove 0 assignments.
After openssl_zalloc, cleanup more "set to 0/NULL" assignments. Many are from github feedback. Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/lhash')
-rw-r--r--crypto/lhash/lhash.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c
index 0c9ce8fe13..4018b60556 100644
--- a/crypto/lhash/lhash.c
+++ b/crypto/lhash/lhash.c
@@ -113,40 +113,20 @@ static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash);
_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
{
_LHASH *ret;
- int i;
- if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
+ if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
goto err0;
- if ((ret->b = OPENSSL_malloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
+ if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
goto err1;
- for (i = 0; i < MIN_NODES; i++)
- ret->b[i] = NULL;
ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
ret->num_nodes = MIN_NODES / 2;
ret->num_alloc_nodes = MIN_NODES;
- ret->p = 0;
ret->pmax = MIN_NODES / 2;
ret->up_load = UP_LOAD;
ret->down_load = DOWN_LOAD;
- ret->num_items = 0;
-
- ret->num_expands = 0;
- ret->num_expand_reallocs = 0;
- ret->num_contracts = 0;
- ret->num_contract_reallocs = 0;
- ret->num_hash_calls = 0;
- ret->num_comp_calls = 0;
- ret->num_insert = 0;
- ret->num_replace = 0;
- ret->num_delete = 0;
- ret->num_no_delete = 0;
- ret->num_retrieve = 0;
- ret->num_retrieve_miss = 0;
- ret->num_hash_comps = 0;
-
- ret->error = 0;
return (ret);
+
err1:
OPENSSL_free(ret);
err0: