[glib] tests: Fix compiler warning



commit 475445e6e0e1388af7c07eedd1fb3c7679e09561
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jun 29 20:14:40 2015 +0100

    tests: Fix compiler warning
    
    Use `const gchar * const` to define a const array of const strings, and
    initialize the array when declaring it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751672

 glib/tests/keyfile.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/glib/tests/keyfile.c b/glib/tests/keyfile.c
index f6ef6ae..0eb734b 100644
--- a/glib/tests/keyfile.c
+++ b/glib/tests/keyfile.c
@@ -508,7 +508,11 @@ test_string (void)
   GKeyFile *keyfile;
   GError *error = NULL;
   gchar *value;
-  const gchar const *list[3];
+  const gchar * const list[3] = {
+    "one",
+    "two;andahalf",
+    "3",
+  };
   const gchar *data =
     "[valid]\n"
     "key1=\\s\\n\\t\\r\\\\\n"
@@ -544,9 +548,6 @@ test_string (void)
   g_key_file_set_string (keyfile, "inserted", "key4", "new\nline");
   g_key_file_set_string (keyfile, "inserted", "key5", "carriage\rreturn");
   g_key_file_set_string (keyfile, "inserted", "key6", "slash\\yay!");
-  list[0] = "one";
-  list[1] = "two;andahalf";
-  list[2] = "3";
   g_key_file_set_string_list (keyfile, "inserted", "key7", list, 3);
 
   check_string_value (keyfile, "inserted", "key1", "simple");


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