summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2008-07-16 15:57:08 +0200
committerDan McGee <dan@archlinux.org>2008-07-18 03:20:13 +0200
commit471ed04790992cd2d1ec6f405f132ce544fcadd2 (patch)
treedd64ed1a17c8e8b5d5ffff09d7a59eabf7805a67
parent59295081982b33640f4e16589ef281872da540b5 (diff)
downloadpacman-471ed04790992cd2d1ec6f405f132ce544fcadd2.tar.gz
pacman-471ed04790992cd2d1ec6f405f132ce544fcadd2.tar.xz
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 <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/alpm_list.c4
1 files changed, 4 insertions, 0 deletions
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;