summaryrefslogtreecommitdiff
path: root/pango/pango-language.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-10 10:20:54 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-10 10:36:05 -0400
commitad1262d9a22ac2d35bc1075748b8b47aaf144711 (patch)
tree6a6a29349383ba19a48c72e5809d76fd2542e79a /pango/pango-language.c
parent518a94a923c9d5324fe5ff434c333c55f49fc3d4 (diff)
downloadpango-ad1262d9a22ac2d35bc1075748b8b47aaf144711.tar.gz
language: Silence compiler warnings
Use a GPtrArray instead of a GArray of pointers, to avoid case-align warnings.
Diffstat (limited to 'pango/pango-language.c')
-rw-r--r--pango/pango-language.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/pango/pango-language.c b/pango/pango-language.c
index bf492a9e..3370bc41 100644
--- a/pango/pango-language.c
+++ b/pango/pango-language.c
@@ -347,11 +347,11 @@ pango_language_from_string (const char *language)
}
len = strlen (language);
- result = g_malloc0 (sizeof (PangoLanguagePrivate) + len + 1);
- g_assert (result);
+ priv = g_malloc0 (sizeof (PangoLanguagePrivate) + len + 1);
+ g_assert (priv);
- priv = (PangoLanguagePrivate *) result;
- result += sizeof (*priv);
+ result = (char *)priv;
+ result += sizeof (PangoLanguagePrivate);
pango_language_private_init (priv);
@@ -746,7 +746,7 @@ parse_default_languages (void)
{
char *p, *p_copy;
gboolean done = FALSE;
- GArray *langs;
+ GPtrArray *langs;
p = getenv ("PANGO_LANGUAGE");
@@ -758,7 +758,7 @@ parse_default_languages (void)
p_copy = p = g_strdup (p);
- langs = g_array_new (TRUE, FALSE, sizeof (PangoLanguage *));
+ langs = g_ptr_array_new ();
while (!done)
{
@@ -776,16 +776,18 @@ parse_default_languages (void)
{
PangoLanguage *l = pango_language_from_string (p);
- g_array_append_val (langs, l);
+ g_ptr_array_add (langs, l);
}
if (!done)
p = end + 1;
}
+ g_ptr_array_add (langs, NULL);
+
g_free (p_copy);
- return (PangoLanguage **) g_array_free (langs, FALSE);
+ return (PangoLanguage **) g_ptr_array_free (langs, FALSE);
}
G_LOCK_DEFINE_STATIC (languages);
@@ -858,7 +860,7 @@ pango_language_get_preferred (void)
/* We call this just for its side-effect of initializing languages */
_pango_script_get_default_language (PANGO_SCRIPT_COMMON);
- return languages;
+ return (PangoLanguage **) languages;
}
/**