]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
linkhash.c: optimised the table_free path
authorEswar Yaganti <naga.malleswara.rao.yaganti@intel.com>
Sat, 25 Jun 2016 17:20:36 +0000 (22:50 +0530)
committerEswar Yaganti <naga.malleswara.rao.yaganti@intel.com>
Sat, 25 Jun 2016 17:20:36 +0000 (22:50 +0530)
linkhash.c

index 64074ac62a99ed70fd043b35764f8dce14e87055..6874273f595be288fbf5c6d4777cead7cd1de0c3 100644 (file)
@@ -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);