[Pkg-libvirt-commits] [libguestfs] 22/26: builder: rename and make public the section/field free functions

Hilko Bengen bengen at moszumanska.debian.org
Thu Mar 20 23:06:11 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag upstream/1.25.46
in repository libguestfs.

commit c6c27620d0688f573c638711b6bcdb94204432cd
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Thu Mar 20 14:43:57 2014 +0100

    builder: rename and make public the section/field free functions
    
    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 */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list