diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-04-26 06:39:16 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-04-26 06:39:16 +0000 |
commit | b2cbeb90cba969d10179dd76356c0e8a8d5b312a (patch) | |
tree | 8af003f79f51aa3eecc49b9070c0d9e0dc34e3b6 /pango | |
parent | 19a4e62e79b8cc7ae53523b05efc7249b01f06de (diff) | |
download | pango-b2cbeb90cba969d10179dd76356c0e8a8d5b312a.tar.gz |
Bug 339749 – pango_language_from_string issues
2006-04-26 Behdad Esfahbod <behdad@gnome.org>
Bug 339749 – pango_language_from_string issues
* pango/pango-utils.c (pango_language_from_string): Avoid lookup that
we know fails...
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-utils.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 3f1b0cb0..2e3b95a5 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -1246,12 +1246,14 @@ pango_language_from_string (const char *language) int len; char *p; - if (!hash) + if (G_UNLIKELY (!hash)) hash = g_hash_table_new (lang_hash, lang_equal); - - result = g_hash_table_lookup (hash, language); - if (result) - return (PangoLanguage *)result; + else + { + result = g_hash_table_lookup (hash, language); + if (result) + return (PangoLanguage *)result; + } len = strlen (language); result = g_malloc (len + 1); |