[glib/wip/alexl/gmarkup-record: 1/2] gmarkup: Change how we detect that a subparser should be pop:ed



commit 2572df41d908344ac3c3b3e129e82db53f22d345
Author: Alexander Larsson <alexl redhat com>
Date:   Sat Sep 8 22:58:57 2018 +0200

    gmarkup: Change how we detect that a subparser should be pop:ed
    
    We used to store a pointer to the element name and when a tag was
    closed the element name was pointer-compared. However, some
    future work will make these strings possibly shared between
    elements, so instead we compare for equality on the GSList node
    in the subparser stack.
    
    This should not affect behaviour in any way.

 glib/gmarkup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/glib/gmarkup.c b/glib/gmarkup.c
index 43bb0c7f8..de6607a0e 100644
--- a/glib/gmarkup.c
+++ b/glib/gmarkup.c
@@ -109,7 +109,7 @@ typedef enum
 
 typedef struct
 {
-  const char *prev_element;
+  GSList *prev_element;
   const GMarkupParser *prev_parser;
   gpointer prev_user_data;
 } GMarkupRecursionTracker;
@@ -162,7 +162,7 @@ struct _GMarkupParseContext
 
   /* subparser support */
   GSList *subparser_stack; /* (GMarkupRecursionTracker *) */
-  const char *subparser_element;
+  GSList *subparser_element;
   gpointer held_user_data;
 };
 
@@ -941,7 +941,7 @@ pop_tag (GMarkupParseContext *context)
 static void
 possibly_finish_subparser (GMarkupParseContext *context)
 {
-  if (current_element (context) == context->subparser_element)
+  if (context->tag_stack == context->subparser_element)
     pop_subparser_stack (context);
 }
 
@@ -2105,7 +2105,7 @@ g_markup_parse_context_push (GMarkupParseContext *context,
   tracker->prev_parser = context->parser;
   tracker->prev_user_data = context->user_data;
 
-  context->subparser_element = current_element (context);
+  context->subparser_element = context->tag_stack;
   context->parser = parser;
   context->user_data = user_data;
 


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