mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Bug 518160 - replace two g_strdup_printf calls in GBookmarkFile
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) svn path=/trunk/; revision=6751
This commit is contained in:
parent
9e9b2fbdd5
commit
c14b3842f2
10
ChangeLog
10
ChangeLog
@ -1,6 +1,14 @@
|
||||
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)
|
||||
|
||||
2008-03-20 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* configure.in:
|
||||
* configure.in:
|
||||
Final fixes for struct statfs.f_fstypename checks (OpenBSD). (#521045)
|
||||
Patch from ephraim_owns@hotmail.com
|
||||
|
||||
|
@ -998,7 +998,7 @@ is_element_full (ParseData *parse_data,
|
||||
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 @@ is_element_full (ParseData *parse_data,
|
||||
* 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);
|
||||
@ -1038,13 +1038,10 @@ is_element_full (ParseData *parse_data,
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user