------------------------------------------------------------
revno: 1415
committer: James Hunt <[email protected]>
branch nick: upstart
timestamp: Tue 2012-12-18 16:31:55 +0000
message:
Stylistic tweaks.
modified:
init/xdg.c
--
lp:upstart
https://code.launchpad.net/~upstart-devel/upstart/trunk
Your team Upstart Reviewers is subscribed to branch lp:upstart.
To unsubscribe from this branch go to
https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'init/xdg.c'
--- init/xdg.c 2012-12-18 16:24:31 +0000
+++ init/xdg.c 2012-12-18 16:31:55 +0000
@@ -121,20 +121,20 @@
char **all_dirs = NULL;
all_dirs = nih_str_array_new (NULL);
-
- if (all_dirs == NULL)
+ if (! all_dirs)
goto error;
/* The current order is inline with Enhanced User Sessions Spec */
/* User's: ~/.config/upstart or XDG_CONFIG_HOME/upstart */
path = xdg_get_config_home ();
- if (path == NULL)
+ if (! path)
goto error;
+
if (path && path[0]) {
- if (nih_strcat_sprintf (&path, NULL, "/%s", INIT_XDG_SUBDIR) == NULL)
+ if (! nih_strcat_sprintf (&path, NULL, "/%s", INIT_XDG_SUBDIR))
goto error;
- if (nih_str_array_add (&all_dirs, NULL, NULL, path) == NULL)
+ if (! nih_str_array_add (&all_dirs, NULL, NULL, path))
goto error;
nih_free (path);
path = NULL;
@@ -142,10 +142,11 @@
/* Legacy User's: ~/.init */
path = get_home_subdir (USERCONFDIR);
- if (path == NULL)
+ if (! path)
goto error;
+
if (path && path[0]) {
- if (nih_str_array_add (&all_dirs, NULL, NULL, path) == NULL)
+ if (! nih_str_array_add (&all_dirs, NULL, NULL, path))
goto error;
nih_free (path);
path = NULL;
@@ -153,30 +154,34 @@
/* Systems': XDG_CONFIG_DIRS/upstart */
dirs = xdg_get_config_dirs ();
- if (dirs == NULL)
+ if (! dirs)
goto error;
+
for (char **p = dirs; p && *p; p++) {
- if (nih_strcat_sprintf (p, NULL, "/%s", INIT_XDG_SUBDIR) == NULL)
+ if (! nih_strcat_sprintf (p, NULL, "/%s", INIT_XDG_SUBDIR))
goto error;
- if (nih_str_array_add (&all_dirs, NULL, NULL, *p) == NULL)
+ if (! nih_str_array_add (&all_dirs, NULL, NULL, *p))
goto error;
}
nih_free (dirs);
dirs = NULL;
/* System's read-only location */
- if (nih_str_array_add (&all_dirs, NULL, NULL, SYSTEM_USERCONFDIR) == NULL)
+ if (! nih_str_array_add (&all_dirs, NULL, NULL, SYSTEM_USERCONFDIR))
goto error;
return all_dirs;
error:
- if (path != NULL)
+ if (path)
nih_free (path);
- if (dirs != NULL)
+
+ if (dirs)
nih_free (dirs);
- if (all_dirs != NULL)
+
+ if (all_dirs)
nih_free (all_dirs);
+
return NULL;
}
--
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/upstart-devel