>From c44fec0058d8a69d29eeb947698bfaf165a6a080 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <[EMAIL PROTECTED]>
Date: Wed, 16 Jul 2008 15:57:08 +0200
Subject: [PATCH] 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 <[EMAIL PROTECTED]>
---
 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 8756740..9889503 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;
-- 
1.5.6.2


_______________________________________________
pacman-dev mailing list
[email protected]
http://archlinux.org/mailman/listinfo/pacman-dev

Reply via email to