From f1bba128929778c21168e84b8970f6623611dc6e Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 18 Sep 2007 11:36:55 +0000 Subject: 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); --- src/env-update.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/env-update.c') 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) { -- cgit v1.2.3