summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-06-09 19:39:24 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-06-09 19:39:24 +0000
commit3eb2b0d3d21c74408bea4427950cc2addc529b3c (patch)
tree76d70e14a15bb7eb6897a0614b7dd44c0387db9d /pango
parente1f707633a02d741a2f12664c2085d30200c1314 (diff)
downloadpango-3eb2b0d3d21c74408bea4427950cc2addc529b3c.tar.gz
Bug 537257 – pango_language_from_string(NULL) not happy
2008-06-09 Behdad Esfahbod <behdad@gnome.org> Bug 537257 – pango_language_from_string(NULL) not happy * pango/pango-language.c (pango_language_from_string): Allow NULL. svn path=/trunk/; revision=2650
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-language.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/pango/pango-language.c b/pango/pango-language.c
index f1fe14a9..89e8f224 100644
--- a/pango/pango-language.c
+++ b/pango/pango-language.c
@@ -78,7 +78,7 @@ pango_language_copy (PangoLanguage *language)
}
static void
-pango_language_free (PangoLanguage *language)
+pango_language_free (PangoLanguage *language G_GNUC_UNUSED)
{
return; /* nothing */
}
@@ -207,7 +207,7 @@ pango_language_get_default (void)
/**
* pango_language_from_string:
- * @language: a string representing a language tag
+ * @language: a string representing a language tag, or %NULL
*
* Take a RFC-3066 format language tag as a string and convert it to a
* #PangoLanguage pointer that can be efficiently copied (copy the
@@ -221,8 +221,9 @@ pango_language_get_default (void)
* Use pango_language_get_default() if you want to get the #PangoLanguage for
* the current locale of the process.
*
- * Return value: an opaque pointer to a #PangoLanguage structure.
- * this will be valid forever after.
+ * Return value: an opaque pointer to a #PangoLanguage structure, or %NULL
+ * if @language was %NULL. The returned pointer will be valid
+ * forever after, and should not be freed.
**/
PangoLanguage *
pango_language_from_string (const char *language)
@@ -232,6 +233,9 @@ pango_language_from_string (const char *language)
int len;
char *p;
+ if (language == NULL)
+ return NULL;
+
if (G_UNLIKELY (!hash))
hash = g_hash_table_new (lang_hash, lang_equal);
else
@@ -364,7 +368,7 @@ static const LangInfo lang_texts[] = {
/**
* pango_language_get_sample_string:
- * @language: a #PangoLanguage
+ * @language: a #PangoLanguage, or %NULL
*
* Get a string that is representative of the characters needed to
* render a particular language. This function is a bad hack for