[devhelp] Factor out the DhParser destructor



commit fb9c90cefd9b0ed87eb45e29b797479444050a05
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Tue Sep 29 17:19:45 2009 -0500

    Factor out the DhParser destructor
    
    Just a little cleanup to make it easier for me to see where things are getting
    freed in DhParser
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596808

 src/dh-parser.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/dh-parser.c b/src/dh-parser.c
index a9cadcc..226d11d 100644
--- a/src/dh-parser.c
+++ b/src/dh-parser.c
@@ -56,6 +56,18 @@ typedef struct {
 } DhParser;
 
 static void
+dh_parser_free (DhParser *parser)
+{
+        // NOTE: priv->book_tree and priv->keywords do not need to be freed
+        // because they're only used to store the locations for the return
+        // params of dh_parser_read_file()
+
+        g_markup_parse_context_free (parser->context);
+        g_free (parser->m_parser);
+        g_free (parser);
+}
+
+static void
 parser_start_node_book (DhParser             *parser,
                         GMarkupParseContext  *context,
                         const gchar          *node_name,
@@ -600,9 +612,7 @@ dh_parser_read_file (const gchar  *path,
 	if (io) {
                 g_io_channel_unref (io);
         }
-	g_markup_parse_context_free (parser->context);
-	g_free (parser->m_parser);
-	g_free (parser);
+	dh_parser_free (parser);
 
 	return result;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]