[Xfce4-commits] <midori:master> Check that g_utf8_normalize was non-NULL, fallback otherwise
Christian Dywan
noreply at xfce.org
Sun Dec 27 22:20:01 CET 2009
Updating branch refs/heads/master
to 8b7fdb7a56349f4e127c3c37ae0eca309aad6a03 (commit)
from 33565cc2f3aaa454c601ec10b71e26aac6f4e7af (commit)
commit 8b7fdb7a56349f4e127c3c37ae0eca309aad6a03
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Dec 27 22:18:02 2009 +0100
Check that g_utf8_normalize was non-NULL, fallback otherwise
midori/midori-locationaction.c | 39 ++++++++++++++++++++++++++++++---------
1 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index aad384d..f05a9d1 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -755,21 +755,42 @@ midori_location_entry_completion_match_cb (GtkEntryCompletion* completion,
match = FALSE;
if (G_LIKELY (uri))
{
- gchar* nkey = g_utf8_normalize (key, -1, G_NORMALIZE_ALL);
- gchar* nuri = g_utf8_normalize (uri, -1, G_NORMALIZE_ALL);
- gchar* fkey = g_utf8_casefold (nkey, -1);
- gchar* furi = g_utf8_casefold (nuri, -1);
+ gchar* nkey;
+ gchar* fkey;
+ gchar* nuri;
+ gchar* furi;
+
+ if ((nkey = g_utf8_normalize (key, -1, G_NORMALIZE_ALL)))
+ {
+ fkey = g_utf8_casefold (nkey, -1);
+ g_free (nkey);
+ }
+ else
+ fkey = g_utf8_casefold (key, -1);
+ if ((nuri = g_utf8_normalize (uri, -1, G_NORMALIZE_ALL)))
+ {
+ furi = g_utf8_casefold (nuri, -1);
+ g_free (nuri);
+ }
+ else
+ furi = g_utf8_casefold (uri, -1);
g_free (uri);
- g_free (nkey);
- g_free (nuri);
match = strstr (furi, fkey) != NULL;
g_free (furi);
if (!match && G_LIKELY (title))
{
- gchar* ntitle = g_utf8_normalize (title, -1, G_NORMALIZE_ALL);
- gchar* ftitle = g_utf8_casefold (ntitle, -1);
- g_free (ntitle);
+ gchar* ntitle;
+ gchar* ftitle;
+
+ if ((ntitle = g_utf8_normalize (title, -1, G_NORMALIZE_ALL)))
+ {
+ ftitle = g_utf8_casefold (ntitle, -1);
+ g_free (ntitle);
+ }
+ else
+ ftitle = g_utf8_casefold (title, -1);
+
match = strstr (ftitle, fkey) != NULL;
g_free (ftitle);
}
More information about the Xfce4-commits
mailing list