From: Eswar Yaganti Date: Sat, 25 Jun 2016 17:20:36 +0000 (+0530) Subject: linkhash.c: optimised the table_free path X-Git-Tag: json-c-0.13-20171207~150^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5fb63a09f9bda16d244c298078ce868e7ce587d2;p=thirdparty%2Fjson-c.git linkhash.c: optimised the table_free path --- diff --git a/linkhash.c b/linkhash.c index 64074ac6..6874273f 100644 --- a/linkhash.c +++ b/linkhash.c @@ -562,10 +562,9 @@ int lh_table_resize(struct lh_table *t, int new_size) void lh_table_free(struct lh_table *t) { struct lh_entry *c; - for(c = t->head; c != NULL; c = c->next) { - if(t->free_fn) { + if(t->free_fn) { + for(c = t->head; c != NULL; c = c->next) t->free_fn(c); - } } free(t->table); free(t);