[pango/matthiasc/for-master: 5/7] Quiet a compiler warning




commit 10ceb82174682a188fe1c5dcd0a4024b8511c39a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jul 10 10:28:32 2021 -0400

    Quiet a compiler warning
    
    Another case where using a GPtrArray instead of
    a GArray of pointers is nicer.

 pango/pangofc-fontmap.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 92a2f64a..62f2cd4b 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -2538,9 +2538,9 @@ _pango_fc_font_map_fc_to_languages (FcLangSet *langset)
   FcStrSet *strset;
   FcStrList *list;
   FcChar8 *s;
-  GArray *langs;
+  GPtrArray *langs;
 
-  langs = g_array_new (TRUE, FALSE, sizeof (PangoLanguage *));
+  langs = g_ptr_array_new ();
 
   strset = FcLangSetGetLangs (langset);
   list = FcStrListCreate (strset);
@@ -2549,13 +2549,15 @@ _pango_fc_font_map_fc_to_languages (FcLangSet *langset)
   while ((s = FcStrListNext (list)))
     {
       PangoLanguage *l = pango_language_from_string ((const char *)s);
-      g_array_append_val (langs, l);
+      g_ptr_array_add (langs, l);
     }
 
   FcStrListDone (list);
   FcStrSetDestroy (strset);
 
-  return (PangoLanguage **) g_array_free (langs, FALSE);
+  g_ptr_array_add (langs, NULL);
+
+  return (PangoLanguage **) g_ptr_array_free (langs, FALSE);
 }
 
 PangoLanguage **


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]