[epiphany] ephy-profile-utils: use an index variable instead of manually setting it



commit c3fa918bdcd9f68efbc4caf6c727da0554fe0642
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Sep 3 15:42:31 2012 +0300

    ephy-profile-utils: use an index variable instead of manually setting it
    
    This allows us to extend this further cleanly.

 lib/ephy-profile-utils.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/lib/ephy-profile-utils.c b/lib/ephy-profile-utils.c
index d5caaa9..829d689 100644
--- a/lib/ephy-profile-utils.c
+++ b/lib/ephy-profile-utils.c
@@ -199,20 +199,20 @@ ephy_profile_utils_do_migration (int test_to_run, gboolean debug)
   char *index = NULL, *version = NULL;
   int status;
   char *argv[6] = { EPHY_PROFILE_MIGRATOR, "-v" };
+  int i = 2; /* index for argv, start filling at 2. */
   char *envp[1] = { "EPHY_LOG_MODULES=ephy-profile" };
 
-  argv[2] = version = g_strdup_printf ("%d", EPHY_PROFILE_MIGRATION_VERSION);
+  argv[i++] = version = g_strdup_printf ("%d", EPHY_PROFILE_MIGRATION_VERSION);
 
   if (test_to_run != -1) {
     index = g_strdup_printf ("%d", test_to_run);
 
-    argv[3] = "-d";
-    argv[4] = index;
-    argv[5] = NULL;
-  } else {
-    argv[3] = NULL;
+    argv[i++] = "-d";
+    argv[i++] = index;
   }
 
+  argv[i++] = NULL;
+
   if (debug)
     argv[0] = ABS_TOP_BUILD_DIR"/lib/"EPHY_PROFILE_MIGRATOR;
 



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