[ekg2-commit] ekg2: themes.c (HEAD) [darkjames]

CVS commit cvs w toxygen.net
Czw, 29 Lis 2007, 12:52:41 CET


Module name:	ekg2
Changes by:	darkjames	2007-11-29 12:52:38

Modified files:
	themes.c

Log message:
LIST_FREE_ITEM ()

Index: themes.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/themes.c,v
diff -d -u -r1.211 -r1.212
--- themes.c	20 Oct 2007 22:14:32 -0000	1.211
+++ themes.c	29 Nov 2007 11:52:38 -0000	1.212
@@ -53,6 +53,12 @@
 };
 static list_t formats = NULL;
 
+static LIST_FREE_ITEM(list_format_free, struct format *) {
+	xfree(data->value);
+	xfree(data->name);
+	xfree(data);
+}
+
 /*
  * format_find()
  *
@@ -915,10 +921,7 @@
 		struct format *f = l->data;
 
 		if (hash == f->name_hash && !xstrcmp(f->name, name)) {
-			xfree(f->value);
-			xfree(f->name);
-			list_remove(&formats, f, 1);
-
+			LIST_REMOVE(&formats, f, list_format_free);
 			return 0;
 		}
 	}
@@ -1046,22 +1049,12 @@
  *
  * usuwa formatki z pamięci.
  */
-void theme_free()
-{
-        list_t l;
-
-        for (l = formats; l; l = l->next) {
-                struct format *f = l->data;
-
-                xfree(f->name);
-                xfree(f->value);
-        }
-
-        list_destroy(formats, 1);
-        formats = NULL;
+void theme_free() {
+	LIST_DESTROY(formats, list_format_free);
+	formats = NULL;
 	no_prompt_cache = 0;
 
-        theme_cache_reset();
+	theme_cache_reset();
 }
 
 void theme_plugins_init() {


Więcej informacji o liście dyskusyjnej ekg2-commit