Use bools
This commit is contained in:
parent
c6c7df47a0
commit
6a14825e74
@ -110,26 +110,26 @@ char *rc_strlist_addsortu (char ***list, const char *item)
|
||||
}
|
||||
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;
|
||||
int i = 0;
|
||||
int retval = -1;
|
||||
bool retval = false;
|
||||
|
||||
if (!lst || ! item)
|
||||
return (-1);
|
||||
return (false);
|
||||
|
||||
while (lst[i])
|
||||
if (! strcmp (lst[i], item)) {
|
||||
free (lst[i]);
|
||||
retval = 0;
|
||||
retval = true;
|
||||
do {
|
||||
lst[i] = lst[i + 1];
|
||||
i++;
|
||||
} while (lst[i]);
|
||||
}
|
||||
|
||||
if (retval)
|
||||
if (! retval)
|
||||
errno = ENOENT;
|
||||
return (retval);
|
||||
}
|
||||
|
4
src/rc.h
4
src/rc.h
@ -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.
|
||||
* @param list to add the item too
|
||||
* @param item to add.
|
||||
* @return 0 on success, otherwise -1 */
|
||||
int rc_strlist_delete (char ***list, const char *item);
|
||||
* @return true on success, otherwise false */
|
||||
bool rc_strlist_delete (char ***list, const char *item);
|
||||
/*! Moves the contents of list2 onto list1, so list2 is effectively emptied.
|
||||
* Returns a pointer to the last item on the new list.
|
||||
* @param list1 to append to
|
||||
|
Loading…
Reference in New Issue
Block a user