update_desktop_file_entry: stylistic fixes based on Colin's review
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 1 Feb 2011 13:35:33 +0000 (13:35 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 16 Feb 2011 14:47:08 +0000 (14:47 +0000)
bus/activation.c

index 5a8eced..7b2a72b 100644 (file)
@@ -287,14 +287,14 @@ update_desktop_file_entry (BusActivation       *activation,
       !_dbus_concat_dir_and_file (&file_path, filename))
     {
       BUS_SET_OOM (error);
-      goto finally;
+      goto out;
     }
 
   if (!_dbus_stat (&file_path, &stat_buf, NULL))
     {
       dbus_set_error (error, DBUS_ERROR_FAILED,
                       "Can't stat the service file\n");
-      goto finally;
+      goto out;
     }
 
   if (!bus_desktop_file_get_string (desktop_file,
@@ -302,14 +302,14 @@ update_desktop_file_entry (BusActivation       *activation,
                                     DBUS_SERVICE_NAME,
                                     &name,
                                     error))
-    goto finally;
+    goto out;
 
   if (!bus_desktop_file_get_string (desktop_file,
                                     DBUS_SERVICE_SECTION,
                                     DBUS_SERVICE_EXEC,
                                     &exec_tmp,
                                     error))
-    goto finally;
+    goto out;
 
   exec = _dbus_strdup (_dbus_replace_install_prefix (exec_tmp));
   dbus_free (exec_tmp);
@@ -326,7 +326,7 @@ update_desktop_file_entry (BusActivation       *activation,
       if (dbus_error_has_name (&tmp_error, DBUS_ERROR_NO_MEMORY))
         {
           dbus_move_error (&tmp_error, error);
-          goto finally;
+          goto out;
         }
       else
         {
@@ -349,7 +349,7 @@ update_desktop_file_entry (BusActivation       *activation,
       if (dbus_error_has_name (&tmp_error, DBUS_ERROR_NO_MEMORY))
         {
           dbus_move_error (&tmp_error, error);
-          goto finally;
+          goto out;
         }
       else
         {
@@ -374,14 +374,14 @@ update_desktop_file_entry (BusActivation       *activation,
         {
           dbus_set_error (error, DBUS_ERROR_FAILED,
                           "Service %s already exists in activation entry list\n", name);
-          goto finally;
+          goto out;
         }
 
       entry = dbus_new0 (BusActivationEntry, 1);
       if (entry == NULL)
         {
           BUS_SET_OOM (error);
-          goto finally;
+          goto out;
         }
 
       entry->name = name;
@@ -401,13 +401,13 @@ update_desktop_file_entry (BusActivation       *activation,
       if (!entry->filename)
         {
           BUS_SET_OOM (error);
-          goto finally;
+          goto out;
         }
 
       if (!_dbus_hash_table_insert_string (activation->entries, entry->name, bus_activation_entry_ref (entry)))
         {
           BUS_SET_OOM (error);
-          goto finally;
+          goto out;
         }
 
       if (!_dbus_hash_table_insert_string (s_dir->entries, entry->filename, bus_activation_entry_ref (entry)))
@@ -415,7 +415,7 @@ update_desktop_file_entry (BusActivation       *activation,
           /* Revert the insertion in the entries table */
           _dbus_hash_table_remove_string (activation->entries, entry->name);
           BUS_SET_OOM (error);
-          goto finally;
+          goto out;
         }
 
       _dbus_verbose ("Added \"%s\" to list of services\n", entry->name);
@@ -429,21 +429,24 @@ update_desktop_file_entry (BusActivation       *activation,
         {
           _dbus_verbose ("The new service name \"%s\" of service file \"%s\" already in cache, ignoring\n",
                          name, _dbus_string_get_const_data (&file_path));
-          goto finally;
+          goto out;
         }
 
+      /* ownership has been transferred to entry, do not free separately */
       dbus_free (entry->name);
-      dbus_free (entry->exec);
-      dbus_free (entry->user);
-      dbus_free (entry->systemd_service);
-      entry->systemd_service = systemd_service;
       entry->name = name;
-      entry->exec = exec;
-      entry->user = user;
-      /* ownership has been transferred to entry, do not free separately */
       name = NULL;
+
+      dbus_free (entry->exec);
+      entry->exec = exec;
       exec = NULL;
+
+      dbus_free (entry->user);
+      entry->user = user;
       user = NULL;
+
+      dbus_free (entry->systemd_service);
+      entry->systemd_service = systemd_service;
       systemd_service = NULL;
 
       if (!_dbus_hash_table_insert_string (activation->entries,
@@ -462,7 +465,7 @@ update_desktop_file_entry (BusActivation       *activation,
   entry->mtime = stat_buf.mtime;
   retval = TRUE;
 
-finally:
+out:
   /* if these have been transferred into entry, the variables will be NULL */
   dbus_free (name);
   dbus_free (exec);