Export dict_free()
authoraland <aland>
Fri, 27 Aug 2004 18:46:10 +0000 (18:46 +0000)
committeraland <aland>
Fri, 27 Aug 2004 18:46:10 +0000 (18:46 +0000)
When creating the tree of values by name, tell the tree code
that we call "free", to get rid of the entries in it, so we don't
have leaks when calling dict_free()

src/lib/dict.c

index 543d551..b693a60 100644 (file)
@@ -85,7 +85,7 @@ static DICT_ATTR *base_attributes[256];
 /*
  *     Free the dictionary_attributes and dictionary_values lists.
  */
-static void dict_free(void)
+void dict_free(void)
 {
        DICT_VENDOR     *dvend, *enext;
 
@@ -727,7 +727,7 @@ static int valuename_cmp(const void *a, const void *b)
                 ((const DICT_VALUE *)b)->attr);
        if (rcode != 0) return rcode;
 
-       return strcasecmp(((const DICT_VALUE *)a)->name,
+return strcasecmp(((const DICT_VALUE *)a)->name,
                          ((const DICT_VALUE *)b)->name);
 }
 
@@ -775,7 +775,7 @@ int dict_init(const char *dir, const char *fn)
                return -1;
        }
 
-       values_byname = rbtree_create(valuename_cmp, NULL, 1);
+       values_byname = rbtree_create(valuename_cmp, free, 1);
        if (!values_byname) {
                return -1;
        }