mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-21 23:38:49 -05:00
added list_is_ptrin()
This commit is contained in:
parent
686e8eaeb5
commit
5ad504240d
@ -100,6 +100,18 @@ static list_t *list_last(list_t *list)
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
int list_is_ptrin(void *needle, list_t *haystack)
|
||||
{
|
||||
list_t *lp;
|
||||
|
||||
for(lp = haystack; lp; lp = lp->next) {
|
||||
if(lp->data == needle) {
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Test for existence of a string in a list_t
|
||||
*/
|
||||
int list_is_strin(char *needle, list_t *haystack)
|
||||
|
@ -35,6 +35,7 @@ list_t *list_new();
|
||||
void list_free(list_t* list);
|
||||
list_t *list_add(list_t* list, void *data);
|
||||
int list_count(list_t* list);
|
||||
int list_is_ptrin(void *needle, list_t *haystack);
|
||||
int list_is_strin(char *needle, list_t *haystack);
|
||||
void list_display(const char *title, list_t *list);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user