glib r6751 - in trunk: . glib
- From: ebassi svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r6751 - in trunk: . glib
- Date: Sat, 22 Mar 2008 17:01:52 +0000 (GMT)
Author: ebassi
Date: Sat Mar 22 17:01:52 2008
New Revision: 6751
URL: http://svn.gnome.org/viewvc/glib?rev=6751&view=rev
Log:
2008-03-22 Emmanuele Bassi <ebassi gnome org>
Bug 518160 - replace two g_strdup_printf calls in GBookmarkFile
* glib/gbookmarkfile.c (is_element_full): Compare the fragments
instead of building two strings; this avoids two g_strdup_printf()
per namespaced element enountered. (#518160, Felix Riemann)
Modified:
trunk/ChangeLog
trunk/glib/gbookmarkfile.c
Modified: trunk/glib/gbookmarkfile.c
==============================================================================
--- trunk/glib/gbookmarkfile.c (original)
+++ trunk/glib/gbookmarkfile.c Sat Mar 22 17:01:52 2008
@@ -998,7 +998,7 @@
const gchar *element,
const gchar sep)
{
- gchar *ns_uri, *ns_name, *s, *resolved;
+ gchar *ns_uri, *ns_name;
const gchar *p, *element_name;
gboolean retval;
@@ -1017,7 +1017,7 @@
* namespace has been set, just do a plain comparison between @full_element
* and @element.
*/
- p = strchr (element_full, ':');
+ p = g_utf8_strchr (element_full, -1, ':');
if (p)
{
ns_name = g_strndup (element_full, p - element_full);
@@ -1037,14 +1037,11 @@
return (0 == strcmp (element_full, element));
}
-
- resolved = g_strdup_printf ("%s%c%s", ns_uri, sep, element_name);
- s = g_strdup_printf ("%s%c%s", namespace, sep, element);
- retval = (0 == strcmp (resolved, s));
+
+ retval = (0 == strcmp (ns_uri, namespace) &&
+ 0 == strcmp (element_name, element));
g_free (ns_name);
- g_free (resolved);
- g_free (s);
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]