diff options
-rw-r--r-- | lib/libalpm/list.c | 14 | ||||
-rw-r--r-- | lib/libalpm/list.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/libalpm/list.c b/lib/libalpm/list.c index 5a24f023..b55a3900 100644 --- a/lib/libalpm/list.c +++ b/lib/libalpm/list.c @@ -217,7 +217,7 @@ int pm_list_count(PMList *list) return(i); } -int pm_list_is_ptrin(PMList *haystack, void *needle) +int pm_list_is_ptrin(void *needle, PMList *haystack) { PMList *lp; @@ -272,4 +272,16 @@ PMList* _alpm_list_reverse(PMList *list) return(newlist); } +PMList *_alpm_list_strdup(PMList *list) +{ + PMList *newlist = NULL; + PMList *lp; + + for(lp = list; lp; lp = lp->next) { + newlist = pm_list_add(newlist, strdup(lp->data)); + } + + return(newlist); +} + /* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libalpm/list.h b/lib/libalpm/list.h index 734a53d5..9b7d0b62 100644 --- a/lib/libalpm/list.h +++ b/lib/libalpm/list.h @@ -52,10 +52,11 @@ PMList *pm_list_add(PMList *list, void *data); PMList *pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn); PMList* _alpm_list_remove(PMList* list, PMList* item); int pm_list_count(PMList *list); -int pm_list_is_ptrin(PMList *haystack, void *needle); +int pm_list_is_ptrin(void *needle, PMList *haystack); PMList *pm_list_is_strin(char *needle, PMList *haystack); PMList *pm_list_last(PMList *list); PMList *_alpm_list_reverse(PMList *list); +PMList *_alpm_list_strdup(PMList *list); #endif /* _ALPM_LIST_H */ |