Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=785b41399020ca87db0d603be00991610e0f2d9e

commit 785b41399020ca87db0d603be00991610e0f2d9e
Author: Michel Hermier <[email protected]>
Date:   Sun May 12 18:04:59 2013 +0200

libflib: Make f_list_free return void.

diff --git a/lib/libflib/flist.c b/lib/libflib/flist.c
index 4a9f92a..e953cd3 100644
--- a/lib/libflib/flist.c
+++ b/lib/libflib/flist.c
@@ -43,8 +43,12 @@ FList *f_list_new () {
}

void f_list_delete (FList *list, FVisitorFunc fn, void *user_data) {
-       while ((list = f_list_free (list, fn, user_data)) != NULL)
-               /* Do nothing */;
+       FList *next;
+
+       for (; list != NULL; list = next) {
+               next = list->next;
+               f_list_free (list, fn, user_data);
+       }
}

FList *f_list_alloc (void *data) {
@@ -61,18 +65,14 @@ FList *f_list_alloc (void *data) {
*
* Returns the next item in the list or NULL if item was the last one in the 
list.
*/
-FList *f_list_free (FList *item, FVisitorFunc fn, void *user_data) {
-       FList *next = NULL;
-
+void f_list_free (FList *item, FVisitorFunc fn, void *user_data) {
if (item != NULL) {
if (fn != NULL) {
fn (item->data, user_data);
}
-               next = item->next;
f_list_remove (item);
free (item);
}
-       return next;
}

void *f_list_get (FList *item) {
diff --git a/lib/libflib/flist.h b/lib/libflib/flist.h
index 5ef00de..8f2a984 100644
--- a/lib/libflib/flist.h
+++ b/lib/libflib/flist.h
@@ -50,7 +50,7 @@ FList *f_list_new (void);
void   f_list_delete (FList *list, FVisitorFunc fn, void *user_data);

FList *f_list_alloc (void *data);
-FList *f_list_free (FList *item, FVisitorFunc fn, void *user_data);
+void   f_list_free (FList *item, FVisitorFunc fn, void *user_data);
void  *f_list_get (FList *item);
void   f_list_set (FList *item, void *data);
void   f_list_insert_after (FList *item, FList *list);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to