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/env-update.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/env-update.c')
-rw-r--r-- | src/env-update.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/env-update.c b/src/env-update.c index 909264d2..516f3580 100644 --- a/src/env-update.c +++ b/src/env-update.c @@ -102,6 +102,7 @@ int env_update (int argc, char **argv) int opt; bool ldconfig = true; bool fork_ldconfig = false; + int nents = 0; applet = argv[0]; @@ -147,12 +148,12 @@ int env_update (int argc, char **argv) if (strcmp (var, "COLON_SEPARATED") == 0) while ((var = strsep (&value, " "))) - mycolons = rc_strlist_addu (mycolons, var); + rc_strlist_addu (&mycolons, var); else if (strcmp (var, "SPACE_SEPARATED") == 0) while ((var = strsep (&value, " "))) - myspaces = rc_strlist_addu (myspaces, var); - else - config = rc_strlist_add (config, entry); + rc_strlist_addu (&myspaces, var); + else + rc_strlist_add (&config, entry); free (tmpent); } @@ -227,7 +228,7 @@ int env_update (int argc, char **argv) } if (! replaced) - envs = rc_strlist_addsort (envs, entry); + rc_strlist_addsort (&envs, entry); free (tmpent); } @@ -285,7 +286,8 @@ int env_update (int argc, char **argv) if (strlen (file) == 0) continue; - ldents = rc_strlist_addu (ldents, file); + if (rc_strlist_addu (&ldents, file)) + nents++; } if (ldconfig) { @@ -293,12 +295,8 @@ int env_update (int argc, char **argv) if (rc_exists (LDSOCONF)) { char **lines = rc_get_list (NULL, LDSOCONF); char *line; - int nents = 0; ld = false; - STRLIST_FOREACH (ldents, line, i) - nents ++; - STRLIST_FOREACH (lines, line, i) if (i > nents || strcmp (line, ldents[i - 1]) != 0) { |