mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-19 23:28:54 +02:00
don't g_strdup()/g_free() all parsed attributes and their values twice but
2001-05-18 Michael Natterer <mitch@convergence.de> * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and their values twice but simply copy the string pointers from the GMarkupAttribute struct to the string arrays before passing them to start_element().
This commit is contained in:
committed by
Michael Natterer
parent
f2a9c8883d
commit
05f143a808
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
2001-05-18 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gmarkup.c: don't g_strdup()/g_free() all parsed attributes and
|
||||||
|
their values twice but simply copy the string pointers from the
|
||||||
|
GMarkupAttribute struct to the string arrays before passing them
|
||||||
|
to start_element().
|
||||||
|
|
||||||
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Renamed g_thread_create to
|
* gthread.c, gthread.h: Renamed g_thread_create to
|
||||||
|
|||||||
@@ -253,10 +253,10 @@ attribute_list_to_arrays (GSList *attributes,
|
|||||||
g_assert (i >= 0);
|
g_assert (i >= 0);
|
||||||
|
|
||||||
if (namesp)
|
if (namesp)
|
||||||
names[i] = g_strdup (attr->name);
|
names[i] = attr->name;
|
||||||
|
|
||||||
if (valuesp)
|
if (valuesp)
|
||||||
values[i] = g_strdup (attr->value);
|
values[i] = attr->value;
|
||||||
|
|
||||||
tmp_list = g_slist_next (tmp_list);
|
tmp_list = g_slist_next (tmp_list);
|
||||||
--i;
|
--i;
|
||||||
@@ -1250,9 +1250,6 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
|||||||
/* Call user callback for element start */
|
/* Call user callback for element start */
|
||||||
start_name = current_element (context);
|
start_name = current_element (context);
|
||||||
|
|
||||||
/* this gratuituously copies the attr names/values
|
|
||||||
* I guess
|
|
||||||
*/
|
|
||||||
attribute_list_to_arrays (context->attributes,
|
attribute_list_to_arrays (context->attributes,
|
||||||
&attr_names,
|
&attr_names,
|
||||||
&attr_values,
|
&attr_values,
|
||||||
@@ -1267,9 +1264,12 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
|||||||
context->user_data,
|
context->user_data,
|
||||||
&tmp_error);
|
&tmp_error);
|
||||||
|
|
||||||
g_strfreev (attr_names);
|
/* Free only the string arrays, as we didn't g_strdup() the attribute
|
||||||
g_strfreev (attr_values);
|
* list's strings
|
||||||
|
*/
|
||||||
|
g_free (attr_names);
|
||||||
|
g_free (attr_values);
|
||||||
|
|
||||||
/* Go ahead and free this. */
|
/* Go ahead and free this. */
|
||||||
g_slist_foreach (context->attributes, (GFunc)attribute_free,
|
g_slist_foreach (context->attributes, (GFunc)attribute_free,
|
||||||
NULL);
|
NULL);
|
||||||
|
|||||||
16
gmarkup.c
16
gmarkup.c
@@ -253,10 +253,10 @@ attribute_list_to_arrays (GSList *attributes,
|
|||||||
g_assert (i >= 0);
|
g_assert (i >= 0);
|
||||||
|
|
||||||
if (namesp)
|
if (namesp)
|
||||||
names[i] = g_strdup (attr->name);
|
names[i] = attr->name;
|
||||||
|
|
||||||
if (valuesp)
|
if (valuesp)
|
||||||
values[i] = g_strdup (attr->value);
|
values[i] = attr->value;
|
||||||
|
|
||||||
tmp_list = g_slist_next (tmp_list);
|
tmp_list = g_slist_next (tmp_list);
|
||||||
--i;
|
--i;
|
||||||
@@ -1250,9 +1250,6 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
|||||||
/* Call user callback for element start */
|
/* Call user callback for element start */
|
||||||
start_name = current_element (context);
|
start_name = current_element (context);
|
||||||
|
|
||||||
/* this gratuituously copies the attr names/values
|
|
||||||
* I guess
|
|
||||||
*/
|
|
||||||
attribute_list_to_arrays (context->attributes,
|
attribute_list_to_arrays (context->attributes,
|
||||||
&attr_names,
|
&attr_names,
|
||||||
&attr_values,
|
&attr_values,
|
||||||
@@ -1267,9 +1264,12 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
|||||||
context->user_data,
|
context->user_data,
|
||||||
&tmp_error);
|
&tmp_error);
|
||||||
|
|
||||||
g_strfreev (attr_names);
|
/* Free only the string arrays, as we didn't g_strdup() the attribute
|
||||||
g_strfreev (attr_values);
|
* list's strings
|
||||||
|
*/
|
||||||
|
g_free (attr_names);
|
||||||
|
g_free (attr_values);
|
||||||
|
|
||||||
/* Go ahead and free this. */
|
/* Go ahead and free this. */
|
||||||
g_slist_foreach (context->attributes, (GFunc)attribute_free,
|
g_slist_foreach (context->attributes, (GFunc)attribute_free,
|
||||||
NULL);
|
NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user