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

CVS commit cvs w toxygen.net
Czw, 22 Lis 2007, 17:33:39 CET


Module name:	ekg2
Changes by:	darkjames	2007-11-22 17:33:36

Modified files:
	log.c

Log message:
struct last list_t ..

Index: log.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/log.c,v
diff -d -u -r1.21 -r1.22
--- log.c	5 Sep 2007 18:36:09 -0000	1.21
+++ log.c	22 Nov 2007 16:33:36 -0000	1.22
@@ -121,6 +121,12 @@
 	list_add(&lasts, ll, 0);
 }
 
+static LIST_FREE_ITEM(list_last_free, struct last *) {
+	xfree(data->uid);
+	xfree(data->message);
+	xfree(data);
+}
+
 /*
  * last_del()
  *
@@ -137,15 +143,22 @@
 
 		l = l->next;
 
-		if (!xstrcasecmp(uid, ll->uid)) {
-			xfree(ll->uid);
-			xfree(ll->message);
-			list_remove(&lasts, ll, 1);
-		}
+		if (!xstrcasecmp(uid, ll->uid))
+			LIST_REMOVE(&lasts, ll, list_last_free);
 	}
 }
 
 /*
+ * last_free()
+ *
+ * zwalnia miejsce po last.
+ */
+void last_free() {
+	LIST_DESTROY(&lasts, list_last_free);
+	lasts = NULL;
+}
+
+/*
  * last_count()
  *
  * zwraca ilość wiadomości w last dla danej osoby.
@@ -168,29 +181,6 @@
 }
 
 /*
- * last_free()
- *
- * zwalnia miejsce po last.
- */
-void last_free()
-{
-	list_t l;
-
-	if (!lasts)
-		return;
-
-	for (l = lasts; l; l = l->next) {
-		struct last *ll = l->data;
-		
-		xfree(ll->uid);
-		xfree(ll->message);
-	}
-
-	list_destroy(lasts, 1);
-	lasts = NULL;
-}
-
-/*
  * xml_escape()
  *
  *    escapes text to be xml-compliant


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