aboutsummaryrefslogtreecommitdiffstats
path: root/epan/strutil.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-05-01 23:56:03 +0000
committerGuy Harris <guy@alum.mit.edu>2004-05-01 23:56:03 +0000
commit67371b5306ca5338e7f1013dea632a9368ce455d (patch)
treeab209294f0c9acb0c728cd70777785f34dcee3f5 /epan/strutil.c
parentec6f31bceda41684ab5eb972438b125a7a2a19b3 (diff)
GLib 1.2[.x]'s "g_string_free()" doesn't return a value.
svn path=/trunk/; revision=10765
Diffstat (limited to 'epan/strutil.c')
-rw-r--r--epan/strutil.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/epan/strutil.c b/epan/strutil.c
index bbf5f1b941..df4dade4d5 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -1,7 +1,7 @@
/* strutil.c
* String utility routines
*
- * $Id: strutil.c,v 1.19 2004/05/01 20:46:24 obiot Exp $
+ * $Id: strutil.c,v 1.20 2004/05/01 23:56:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -405,6 +405,9 @@ xml_escape(const gchar *unescaped)
GString *buffer = g_string_sized_new(128);
const gchar *p;
gchar c;
+#if GLIB_MAJOR_VERSION < 2
+ gchar *ret;
+#endif
p = unescaped;
while ( (c = *p++) ) {
@@ -429,10 +432,19 @@ xml_escape(const gchar *unescaped)
break;
}
}
+#if GLIB_MAJOR_VERSION >= 2
/* Return the string value contained within the GString
* after getting rid of the GString structure.
* This is the way to do this, see the GLib reference. */
return g_string_free(buffer, FALSE);
+#else
+ /* But it's not the way to do it in GLib 1.2[.x], as
+ * 1.2[.x]'s "g_string_free()" doesn't return anything.
+ * This is the way to do this in GLib 1.2[.x]. */
+ ret = buffer->str;
+ g_string_free(buffer, FALSE);
+ return ret;
+#endif
}