diff options
author | Nagy Gabor <ngaba@bibl.u-szeged.hu> | 2008-07-16 15:57:08 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-07-17 20:20:13 -0500 |
commit | 471ed04790992cd2d1ec6f405f132ce544fcadd2 (patch) | |
tree | dd64ed1a17c8e8b5d5ffff09d7a59eabf7805a67 /lib | |
parent | 59295081982b33640f4e16589ef281872da540b5 (diff) | |
download | 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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/alpm_list.c | 4 |
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; |