From 471ed04790992cd2d1ec6f405f132ce544fcadd2 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Wed, 16 Jul 2008 15:57:08 +0200 Subject: alpm_list_remove treat NULL needle as "nothing" So if you want to remove NULL needle from a list, alpm_list_remove will return with "not found". Signed-off-by: Nagy Gabor Signed-off-by: Dan McGee --- lib/libalpm/alpm_list.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/libalpm/alpm_list.c') diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c index 87567402..98895032 100644 --- a/lib/libalpm/alpm_list.c +++ b/lib/libalpm/alpm_list.c @@ -302,6 +302,10 @@ alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needl *data = NULL; } + if(needle == NULL) { + return(haystack); + } + while(i) { if(i->data == NULL) { continue; -- cgit v1.2.3-24-g4f1b