summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-03 08:07:58 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-03 08:07:58 +0000
commit5ad504240dc8747eb91efaba14577847eb0bfcdd (patch)
tree6add18d4616abda3559ac0f69e07049f52f5af75 /src
parent686e8eaeb5dfe74f28c5f1b25bb0a7f555ff2e6d (diff)
added list_is_ptrin()
Diffstat (limited to 'src')
-rw-r--r--src/pacman/list.c12
-rw-r--r--src/pacman/list.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/pacman/list.c b/src/pacman/list.c
index 84af1784..c639e124 100644
--- a/src/pacman/list.c
+++ b/src/pacman/list.c
@@ -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)
diff --git a/src/pacman/list.h b/src/pacman/list.h
index ca738f9e..845ca5c8 100644
--- a/src/pacman/list.h
+++ b/src/pacman/list.h
@@ -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);