added list_is_ptrin()
This commit is contained in:
parent
686e8eaeb5
commit
5ad504240d
2 changed files with 13 additions and 0 deletions
|
@ -100,6 +100,18 @@ static list_t *list_last(list_t *list)
|
||||||
return(ptr);
|
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
|
/* Test for existence of a string in a list_t
|
||||||
*/
|
*/
|
||||||
int list_is_strin(char *needle, list_t *haystack)
|
int list_is_strin(char *needle, list_t *haystack)
|
||||||
|
|
|
@ -35,6 +35,7 @@ list_t *list_new();
|
||||||
void list_free(list_t* list);
|
void list_free(list_t* list);
|
||||||
list_t *list_add(list_t* list, void *data);
|
list_t *list_add(list_t* list, void *data);
|
||||||
int list_count(list_t* list);
|
int list_count(list_t* list);
|
||||||
|
int list_is_ptrin(void *needle, list_t *haystack);
|
||||||
int list_is_strin(char *needle, list_t *haystack);
|
int list_is_strin(char *needle, list_t *haystack);
|
||||||
void list_display(const char *title, list_t *list);
|
void list_display(const char *title, list_t *list);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue