diff options
author | Roy Marples <roy@marples.name> | 2007-09-18 11:36:55 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-09-18 11:36:55 +0000 |
commit | f1bba128929778c21168e84b8970f6623611dc6e (patch) | |
tree | 25bbbf017bd14dfe9a81ff4070c70d24dd8a7848 /src/librc.c | |
parent | 99eabdc3ba537194432a11c5793ca4117296227b (diff) |
API change! rc_strlist_add and friends now take char *** instead of
char ** and return a pointer to the item added instead of the new
list head. This is so we can easily tell if the item was successfully
added or not instead of iterating through the list looking for it.
list = rc_strlist_add (list, item);
becomes
rc_strlist_add (&list, item);
Diffstat (limited to 'src/librc.c')
-rw-r--r-- | src/librc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librc.c b/src/librc.c index e5ea5710..a0b5f0f0 100644 --- a/src/librc.c +++ b/src/librc.c @@ -53,7 +53,7 @@ char **rc_get_runlevels (void) STRLIST_FOREACH (dirs, dir, i) { char *path = rc_strcatpaths (RC_RUNLEVELDIR, dir, (char *) NULL); if (rc_is_dir (path)) - runlevels = rc_strlist_addsort (runlevels, dir); + rc_strlist_addsort (&runlevels, dir); free (path); } rc_strlist_free (dirs); @@ -65,7 +65,7 @@ librc_hidden_def(rc_get_runlevels) char *rc_get_runlevel (void) { FILE *fp; - static char buffer [PATH_MAX]; + static char buffer[PATH_MAX]; if (! (fp = fopen (SOFTLEVEL, "r"))) { snprintf (buffer, sizeof (buffer), "sysinit"); @@ -198,7 +198,7 @@ char **rc_service_options (const char *service) if (buffer[strlen (buffer) - 1] == '\n') buffer[strlen (buffer) - 1] = '\0'; while ((token = strsep (&p, " "))) - opts = rc_strlist_addsort (opts, token); + rc_strlist_addsort (&opts, token); } pclose (fp); return (opts); @@ -728,7 +728,7 @@ char **rc_services_in_state (rc_service_state_t state) int j; STRLIST_FOREACH (entries, e, j) - list = rc_strlist_addsortu (list, e); + rc_strlist_addsortu (&list, e); if (entries) free (entries); @@ -807,7 +807,7 @@ char **rc_services_scheduled_by (const char *service) char *file = rc_strcatpaths (RC_SVCDIR, "scheduled", dir, service, (char *) NULL); if (rc_exists (file)) - list = rc_strlist_add (list, file); + rc_strlist_add (&list, file); free (file); } rc_strlist_free (dirs); |