They will be needed also elsewhere.
---
builder/index-struct.c | 19 ++++++++-----------
builder/index-struct.h | 10 ++++++++++
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/builder/index-struct.c b/builder/index-struct.c
index f32534c..eacca6c 100644
--- a/builder/index-struct.c
+++ b/builder/index-struct.c
@@ -24,9 +24,6 @@
#include "index-struct.h"
-static void free_section (struct section *section);
-static void free_field (struct field *field);
-
void
parse_context_init (struct parse_context *context)
{
@@ -36,25 +33,25 @@ parse_context_init (struct parse_context *context)
void
parse_context_free (struct parse_context *context)
{
- free_section (context->parsed_index);
+ section_free (context->parsed_index);
}
-static void
-free_section (struct section *section)
+void
+section_free (struct section *section)
{
if (section) {
- free_section (section->next);
+ section_free (section->next);
free (section->name);
- free_field (section->fields);
+ field_free (section->fields);
free (section);
}
}
-static void
-free_field (struct field *field)
+void
+field_free (struct field *field)
{
if (field) {
- free_field (field->next);
+ field_free (field->next);
free (field->key);
free (field->subkey);
free (field->value);
diff --git a/builder/index-struct.h b/builder/index-struct.h
index 7e16637..3edd06d 100644
--- a/builder/index-struct.h
+++ b/builder/index-struct.h
@@ -53,4 +53,14 @@ extern void parse_context_init (struct parse_context *state);
/* Free the content of a parse_context. The actual pointer is not freed. */
extern void parse_context_free (struct parse_context *state);
+/* Free the content of a section, recursively freeing also its fields.
+ * The actual pointer is not freed.
+ */
+extern void section_free (struct section *section);
+
+/* Free the content of a field, recursively freeing also its next field.
+ * The actual pointer is not freed.
+ */
+extern void field_free (struct field *field);
+
#endif /* INDEX_STRUCT_H */
--
1.8.3.1