[Pkg-voip-commits] [bctoolbox] 57/60: Added copy_list_reverse_with_data

Bernhard Schmidt berni at moszumanska.debian.org
Sun Oct 15 22:42:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

berni pushed a commit to branch debian/sid
in repository bctoolbox.

commit a11248a2211a32cb74743e51a2f45af36688e154
Author: Sylvain Berfini <sylvain.berfini at belledonne-communications.com>
Date:   Wed Jul 19 12:16:31 2017 +0200

    Added copy_list_reverse_with_data
---
 include/bctoolbox/list.h | 2 ++
 src/containers/list.c    | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/include/bctoolbox/list.h b/include/bctoolbox/list.h
index d388a0c..6c97ceb 100644
--- a/include/bctoolbox/list.h
+++ b/include/bctoolbox/list.h
@@ -76,6 +76,8 @@ BCTBX_PUBLIC bctbx_list_t * bctbx_list_insert(bctbx_list_t * list, bctbx_list_t
 BCTBX_PUBLIC bctbx_list_t * bctbx_list_copy(const bctbx_list_t * list);
 /*copy list elements and associated data, using the supplied function pointer*/
 BCTBX_PUBLIC bctbx_list_t* bctbx_list_copy_with_data(const bctbx_list_t* list, bctbx_list_copy_func copyfunc);
+/*Same as bctbx_list_copy_with_data but in reverse order*/
+BCTBX_PUBLIC bctbx_list_t* bctbx_list_copy_reverse_with_data(const bctbx_list_t* list, bctbx_list_copy_func copyfunc);
 
 BCTBX_PUBLIC bctbx_list_t* bctbx_list_next(const bctbx_list_t *elem);
 BCTBX_PUBLIC void* bctbx_list_get_data(const bctbx_list_t *elem);
diff --git a/src/containers/list.c b/src/containers/list.c
index 70bd20c..d1bb524 100644
--- a/src/containers/list.c
+++ b/src/containers/list.c
@@ -325,3 +325,11 @@ bctbx_list_t* bctbx_list_copy_with_data(const bctbx_list_t* list, bctbx_list_cop
 	return copy;
 }
 
+bctbx_list_t* bctbx_list_copy_reverse_with_data(const bctbx_list_t* list, bctbx_list_copy_func copyfunc){
+	bctbx_list_t* copy=NULL;
+	const bctbx_list_t* iter;
+	for(iter=list;iter!=NULL;iter=bctbx_list_next(iter)){
+		copy=bctbx_list_prepend(copy,copyfunc(iter->data));
+	}
+	return copy;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/bctoolbox.git



More information about the Pkg-voip-commits mailing list