From 0c2cc108d332837de4a33ca9cabe717bd414c407 Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Fri, 19 Oct 2007 13:17:51 -0400 Subject: Add pmdelta_t structure and functions to libalpm. Signed-off-by: Nathan Jones Signed-off-by: Dan McGee --- lib/libalpm/alpm_list.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/libalpm/alpm_list.c') diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c index 5671b4a2..2301411a 100644 --- a/lib/libalpm/alpm_list.c +++ b/lib/libalpm/alpm_list.c @@ -378,6 +378,24 @@ alpm_list_t SYMEXPORT *alpm_list_strdup(const alpm_list_t *list) return(newlist); } +/** + * @brief Copy a list, without copying data. + * + * @param list the list to copy + * + * @return a copy of the original list + */ +alpm_list_t SYMEXPORT *alpm_list_copy(const alpm_list_t *list) +{ + const alpm_list_t *lp = list; + alpm_list_t *newlist = NULL; + while(lp) { + newlist = alpm_list_add(newlist, lp->data); + lp = lp->next; + } + return(newlist); +} + /** * @brief Create a new list in reverse order. * -- cgit v1.2.3-70-g09d2