]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Lists_CheckDupeMask(): return pointer to already existing item
authorAlexander Barton <alex@barton.de>
Sun, 25 Dec 2011 18:42:03 +0000 (19:42 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 25 Dec 2011 18:42:03 +0000 (19:42 +0100)
The old behavior of returning true/false is compatible to this change,
so there are no other code changes required.

src/ngircd/lists.c
src/ngircd/lists.h

index 63c16b0da1ed268af0a7f42bd6e49fe22a13da1a..11f8e888fec5292ff9b169c2fa9cd4954b2fc413 100644 (file)
@@ -240,17 +240,17 @@ Lists_Free(struct list_head *head)
  * @param Mask IRC mask to test.
  * @return true if mask is already stored in the list, false otherwise.
  */
  * @param Mask IRC mask to test.
  * @return true if mask is already stored in the list, false otherwise.
  */
-GLOBAL bool
+GLOBAL struct list_elem *
 Lists_CheckDupeMask(const struct list_head *h, const char *Mask )
 {
        struct list_elem *e;
        e = h->first;
        while (e) {
                if (strcasecmp(e->mask, Mask) == 0)
 Lists_CheckDupeMask(const struct list_head *h, const char *Mask )
 {
        struct list_elem *e;
        e = h->first;
        while (e) {
                if (strcasecmp(e->mask, Mask) == 0)
-                       return true;
+                       return e;
                e = e->next;
        }
                e = e->next;
        }
-       return false;
+       return NULL;
 }
 
 /**
 }
 
 /**
index f9a4c91cf5158b9c52fe7a4f5dbf1df9080fc86a..f709f3fa65a4c149329f095d196ba9b431cdddef 100644 (file)
@@ -30,7 +30,7 @@ GLOBAL struct list_elem *Lists_GetFirst PARAMS((const struct list_head *));
 GLOBAL struct list_elem *Lists_GetNext PARAMS((const struct list_elem *));
 
 GLOBAL bool Lists_Check PARAMS((struct list_head *head, CLIENT *client));
 GLOBAL struct list_elem *Lists_GetNext PARAMS((const struct list_elem *));
 
 GLOBAL bool Lists_Check PARAMS((struct list_head *head, CLIENT *client));
-GLOBAL bool Lists_CheckDupeMask PARAMS((const struct list_head *head,
+GLOBAL struct list_elem *Lists_CheckDupeMask PARAMS((const struct list_head *head,
                                        const char *mask));
 
 GLOBAL bool Lists_Add PARAMS((struct list_head *h, const char *Mask,
                                        const char *mask));
 
 GLOBAL bool Lists_Add PARAMS((struct list_head *h, const char *Mask,