Use bools

This commit is contained in:
Roy Marples 2007-09-25 17:32:12 +00:00
parent c6c7df47a0
commit 6a14825e74
2 changed files with 7 additions and 7 deletions

View File

@ -110,26 +110,26 @@ char *rc_strlist_addsortu (char ***list, const char *item)
} }
librc_hidden_def(rc_strlist_addsortu) librc_hidden_def(rc_strlist_addsortu)
int rc_strlist_delete (char ***list, const char *item) bool rc_strlist_delete (char ***list, const char *item)
{ {
char **lst = *list; char **lst = *list;
int i = 0; int i = 0;
int retval = -1; bool retval = false;
if (!lst || ! item) if (!lst || ! item)
return (-1); return (false);
while (lst[i]) while (lst[i])
if (! strcmp (lst[i], item)) { if (! strcmp (lst[i], item)) {
free (lst[i]); free (lst[i]);
retval = 0; retval = true;
do { do {
lst[i] = lst[i + 1]; lst[i] = lst[i + 1];
i++; i++;
} while (lst[i]); } while (lst[i]);
} }
if (retval) if (! retval)
errno = ENOENT; errno = ENOENT;
return (retval); return (retval);
} }

View File

@ -457,8 +457,8 @@ char *rc_strlist_addsortu (char ***list, const char *item);
/*! Free the item and remove it from the list. Return 0 on success otherwise -1. /*! Free the item and remove it from the list. Return 0 on success otherwise -1.
* @param list to add the item too * @param list to add the item too
* @param item to add. * @param item to add.
* @return 0 on success, otherwise -1 */ * @return true on success, otherwise false */
int rc_strlist_delete (char ***list, const char *item); bool rc_strlist_delete (char ***list, const char *item);
/*! Moves the contents of list2 onto list1, so list2 is effectively emptied. /*! Moves the contents of list2 onto list1, so list2 is effectively emptied.
* Returns a pointer to the last item on the new list. * Returns a pointer to the last item on the new list.
* @param list1 to append to * @param list1 to append to