modules: Cosmetics
authorMatthias Clasen <mclasen@redhat.com>
Tue, 17 Jan 2023 12:46:57 +0000 (07:46 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 17 Jan 2023 12:47:28 +0000 (07:47 -0500)
Use g_strv_length, instead of open-coding it.

gtk/gtkmodules.c

index e505790cb48ba1c9161e3e025b5bfc7831bf3558..51b09166243ce2f21228a115b777c4fa6a44babd 100644 (file)
@@ -146,18 +146,16 @@ get_module_path (void)
 char **
 _gtk_get_module_path (const char *type)
 {
-  char **paths = get_module_path();
+  char **paths = get_module_path ();
   char **path;
   char **result;
   int count = 0;
 
-  for (path = paths; *path; path++)
-    count++;
-
+  count = g_strv_length (paths);
   result = g_new (char *, count * 4 + 1);
 
   count = 0;
-  for (path = get_module_path (); *path; path++)
+  for (path = paths; *path; path++)
     {
       result[count++] = g_build_filename (*path, GTK_BINARY_VERSION, GTK_HOST, type, NULL);
       result[count++] = g_build_filename (*path, GTK_BINARY_VERSION, type, NULL);