[gnome-builder] xml-utils:Fix issue with find opening, closing tag and unbalanced elements
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] xml-utils:Fix issue with find opening, closing tag and unbalanced elements
- Date: Mon, 11 May 2015 23:24:45 +0000 (UTC)
commit 4763bb5ee32c38893d96c998bb56f074e2d4be7e
Author: Dimitris Zenios <dimitris zenios gmail com>
Date: Tue May 12 02:17:03 2015 +0300
xml-utils:Fix issue with find opening, closing tag and unbalanced elements
libide/util/ide-xml.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/libide/util/ide-xml.c b/libide/util/ide-xml.c
index 8d60f7c..16ff31d 100644
--- a/libide/util/ide-xml.c
+++ b/libide/util/ide-xml.c
@@ -249,13 +249,22 @@ ide_xml_find_closing_element (const GtkTextIter *start,
if (element_name != NULL)
{
if(g_strcmp0 (g_queue_peek_head (element_queue), element_name) == 0)
- g_free (g_queue_pop_head (element_queue));
- g_free (element_name);
+ {
+ g_free (g_queue_pop_head (element_queue));
+ g_free (element_name);
+ }
+ /*Unbalanced element.Stop parsing*/
+ else
+ {
+ g_free (element_name);
+ goto completed;
+ }
}
}
end = found_element_end;
}
+completed:
element_queue_length = g_queue_get_length (element_queue);
g_queue_free_full (element_queue, g_free);
@@ -303,13 +312,22 @@ ide_xml_find_opening_element (const GtkTextIter *start,
if (element_name != NULL)
{
if(g_strcmp0 (g_queue_peek_head(element_queue), element_name) == 0)
- g_free (g_queue_pop_head (element_queue));
- g_free (element_name);
+ {
+ g_free (g_queue_pop_head (element_queue));
+ g_free (element_name);
+ }
+ /*Unbalanced element.Stop parsing*/
+ else
+ {
+ g_free (element_name);
+ goto completed;
+ }
}
}
start = found_element_start;
}
+completed:
element_queue_length = g_queue_get_length (element_queue);
g_queue_free_full (element_queue, g_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]