aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-11 10:11:12 +0000
committerRoy Marples <roy@marples.name>2007-10-11 10:11:12 +0000
commitebcfd49e9c17cca34d7a8146ae73fe626dde622e (patch)
treeed11152fffc5826756ab8b84049425288e01ae10
parent64d1dd9da0c80691a562dad932dbca37bcfd6195 (diff)
Fix deleting items from string lists.
-rw-r--r--src/librc-strlist.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librc-strlist.c b/src/librc-strlist.c
index 0f3225e9..507f269c 100644
--- a/src/librc-strlist.c
+++ b/src/librc-strlist.c
@@ -114,24 +114,24 @@ bool rc_strlist_delete (char ***list, const char *item)
{
char **lst = *list;
int i = 0;
- bool retval = false;
if (!lst || ! item)
return (false);
- while (lst[i])
- if (! strcmp (lst[i], item)) {
+ while (lst[i]) {
+ if (strcmp (lst[i], item) == 0) {
free (lst[i]);
- retval = true;
do {
lst[i] = lst[i + 1];
i++;
} while (lst[i]);
+ return (true);
}
+ i++;
+ }
- if (! retval)
- errno = ENOENT;
- return (retval);
+ errno = ENOENT;
+ return (false);
}
librc_hidden_def(rc_strlist_delete)