summaryrefslogtreecommitdiff
path: root/gdata/gdata-entry.c
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2009-07-03 10:12:09 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2009-07-03 10:12:09 +0100
commit97355e5cfc3bb12afb30b690aa0e4b185457b931 (patch)
treef8057de830948117508d568a3a02305de622ee4a /gdata/gdata-entry.c
parent65531a6bae54340722c2cdaa5e156a9ca9a49637 (diff)
downloadlibgdata-97355e5cfc3bb12afb30b690aa0e4b185457b931.tar.gz
[core] Made the get_xml functions use a single GString throughout
Previously, each call to _gdata_parsable_get_xml would create its own GString, then destroy it at the end. Now, the same GString is reused throughout a tree of calls to _gdata_parsable_get_xml, saving quite a few allocations/frees (in exchange for more reallocations).
Diffstat (limited to 'gdata/gdata-entry.c')
-rw-r--r--gdata/gdata-entry.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/gdata/gdata-entry.c b/gdata/gdata-entry.c
index 72f1a73a..4ce3abc6 100644
--- a/gdata/gdata-entry.c
+++ b/gdata/gdata-entry.c
@@ -444,23 +444,14 @@ get_xml (GDataParsable *parsable, GString *xml_string)
g_free (content);
}
- for (categories = priv->categories; categories != NULL; categories = categories->next) {
- gchar *xml = _gdata_parsable_get_xml (GDATA_PARSABLE (categories->data), FALSE);
- g_string_append (xml_string, xml);
- g_free (xml);
- }
+ for (categories = priv->categories; categories != NULL; categories = categories->next)
+ _gdata_parsable_get_xml (GDATA_PARSABLE (categories->data), xml_string, FALSE);
- for (links = priv->links; links != NULL; links = links->next) {
- gchar *xml = _gdata_parsable_get_xml (GDATA_PARSABLE (links->data), FALSE);
- g_string_append (xml_string, xml);
- g_free (xml);
- }
+ for (links = priv->links; links != NULL; links = links->next)
+ _gdata_parsable_get_xml (GDATA_PARSABLE (links->data), xml_string, FALSE);
- for (authors = priv->authors; authors != NULL; authors = authors->next) {
- gchar *xml = _gdata_parsable_get_xml (GDATA_PARSABLE (authors->data), FALSE);
- g_string_append (xml_string, xml);
- g_free (xml);
- }
+ for (authors = priv->authors; authors != NULL; authors = authors->next)
+ _gdata_parsable_get_xml (GDATA_PARSABLE (authors->data), xml_string, FALSE);
}
static void