summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/variable.c b/variable.c
index 54ac046..0ea71cd 100644
--- a/variable.c
+++ b/variable.c
@@ -539,14 +539,6 @@ initialize_file_variables (struct file *file, int reading)
/* Pop the top set off the current variable set list,
and free all its storage. */
-static void
-free_variable_name_and_value (const void *item)
-{
- struct variable *v = (struct variable *) item;
- free (v->name);
- free (v->value);
-}
-
struct variable_set_list *
create_new_variable_set (void)
{
@@ -565,6 +557,23 @@ create_new_variable_set (void)
return setlist;
}
+static void
+free_variable_name_and_value (const void *item)
+{
+ struct variable *v = (struct variable *) item;
+ free (v->name);
+ free (v->value);
+}
+
+void
+free_variable_set (struct variable_set_list *list)
+{
+ hash_map (&list->set->table, free_variable_name_and_value);
+ hash_free (&list->set->table, 1);
+ free ((char *) list->set);
+ free ((char *) list);
+}
+
/* Create a new variable set and push it on the current setlist.
If we're pushing a global scope (that is, the current scope is the global
scope) then we need to "push" it the other way: file variable sets point