[epiphany] ephy-profile-utils: tweak migrator location code



commit 0f356e2c1eb200fd286b468bf0c7adc4b232d9a0
Author: Xan Lopez <xan igalia com>
Date:   Wed May 16 14:32:57 2012 +0900

    ephy-profile-utils: tweak migrator location code
    
    The path to the just built migrator is known at compile time, so no
    need to create strings at runtime. Also, share the name of the binary
    itself to avoid silly bugs like last time.

 lib/ephy-profile-utils.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/lib/ephy-profile-utils.c b/lib/ephy-profile-utils.c
index 1aa5fcd..297159e 100644
--- a/lib/ephy-profile-utils.c
+++ b/lib/ephy-profile-utils.c
@@ -187,14 +187,16 @@ _ephy_profile_utils_query_form_auth_data (const char *uri,
   g_free (key_str);
 }
 
+#define EPHY_PROFILE_MIGRATOR "ephy-profile-migrator"
+
 gboolean
 ephy_profile_utils_do_migration (int test_to_run, gboolean debug)
 {
   gboolean ret;
   GError *error = NULL;
-  char *index = NULL, *path = NULL;
+  char *index = NULL;
   int status;
-  char *argv[3] = { "ephy-profile-migrator" };
+  char *argv[3] = { EPHY_PROFILE_MIGRATOR };
   char *envp[1] = { "EPHY_LOG_MODULES=ephy-profile" };
 
   if (test_to_run != -1) {
@@ -207,15 +209,12 @@ ephy_profile_utils_do_migration (int test_to_run, gboolean debug)
     argv[1] = NULL;
   }
 
-  if (debug) {
-    path = g_strdup_printf ("%s/lib/ephy-profile-migrator", TOP_BUILD_DIR);
-    argv[0] = path;
-  }
+  if (debug)
+    argv[0] = TOP_BUILD_DIR"/lib/"EPHY_PROFILE_MIGRATOR;
 
   ret = g_spawn_sync (NULL, argv, envp, G_SPAWN_SEARCH_PATH,
                       NULL, NULL, NULL, NULL,
                       &status, &error);
-  g_free (path);
   g_free (index);
     
   if (error) {



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