1
0
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:
Aurelien Foret 2005-04-03 08:07:58 +00:00
parent 686e8eaeb5
commit 5ad504240d
2 changed files with 13 additions and 0 deletions

View File

@ -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)

View File

@ -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);