[ekg2-commit] ekg2: irc.c (HEAD) [darkjames]
CVS commit
cvs w toxygen.net
Czw, 22 Lis 2007, 19:06:33 CET
Module name: ekg2
Changes by: darkjames 2007-11-22 19:06:31
Modified files:
irc.c
Log message:
LIST_FREE_ITEM()
Index: irc.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/irc/irc.c,v
diff -d -u -r1.164 -r1.165
--- irc.c 23 Jul 2007 16:26:51 -0000 1.164
+++ irc.c 22 Nov 2007 18:06:31 -0000 1.165
@@ -181,6 +181,19 @@
return 0;
}
+static LIST_FREE_ITEM(list_irc_awaylog_free, irc_away_log_t *) {
+ xfree(data->channame);
+ xfree(data->uid);
+ xfree(data->msg);
+ xfree(data);
+}
+
+static LIST_FREE_ITEM(list_irc_resolver_free, connector_t *) {
+ xfree(data->address);
+ xfree(data->hostname);
+ xfree(data);
+}
+
/**
* irc_session_deinit()
*
@@ -217,27 +230,13 @@
xfree(j->host_ident);
xfree(j->nick);
- for (tmplist=j->bindlist; tmplist; tmplist=tmplist->next) {
- xfree( ((connector_t *)tmplist->data)->address);
- xfree( ((connector_t *)tmplist->data)->hostname);
- }
- list_destroy(j->bindlist, 1);
+ LIST_DESTROY(j->bindlist, list_irc_resolver_free);
+ LIST_DESTROY(j->connlist, list_irc_resolver_free);
- for (tmplist=j->connlist; tmplist; tmplist=tmplist->next) {
- xfree( ((connector_t *)tmplist->data)->address);
- xfree( ((connector_t *)tmplist->data)->hostname);
- }
- list_destroy(j->connlist, 1);
/* XXX, hilights list_t */
/* NOTE: j->awaylog shouldn't exists here */
- for (tmplist=j->awaylog; tmplist; tmplist=tmplist->next) {
- irc_awaylog_t *e = tmplist->data;
- xfree(e->channame);
- xfree(e->uid);
- xfree(e->msg);
- }
- list_destroy(j->awaylog, 1);
+ LIST_DESTROY(j->awaylog, list_irc_awaylog_free);
irc_free_people(s, j);
@@ -544,12 +543,7 @@
else { rlist = &(j->connlist); j->conntmplist = NULL; }
if (*rlist) {
- list_t tmplist;
- for (tmplist=*rlist; tmplist; tmplist=tmplist->next) {
- xfree( ((connector_t *)tmplist->data)->address);
- xfree( ((connector_t *)tmplist->data)->hostname);
- }
- list_destroy(*rlist, 1);
+ LIST_DESTROY(*rlist, list_irc_resolver_free);
*rlist = NULL;
}
#ifdef NO_POSIX_SYSTEM
@@ -1355,10 +1349,10 @@
xfree(e->msg);
}
print_status("irc_awaylog_end", session_name(session));
- }
- list_destroy(j->awaylog, 1);
- j->awaylog = NULL;
+ list_destroy(j->awaylog, 1);
+ j->awaylog = NULL;
+ }
}
return 0;
}
Więcej informacji o liście dyskusyjnej ekg2-commit