Permalink
Browse files

Make owl_list_free_simple a special case of owl_list_cleanup.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
  • Loading branch information...
1 parent 8c59178 commit 5e5f08f3fcfd064d18df1008f09c00202a36ffdb @andersk andersk committed Feb 28, 2010
Showing with 9 additions and 12 deletions.
  1. +1 −1 aim.c
  2. +4 −7 list.c
  3. +1 −1 message.c
  4. +1 −1 messagelist.c
  5. +2 −2 view.c
View
2 aim.c
@@ -1615,7 +1615,7 @@ static int faimtest_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...)
owl_list_append_element(&list, (void *)&SNs[i*(MAXSNLEN+1)]);
}
owl_function_aimsearch_results(address, &list);
- owl_list_free_simple(&list);
+ owl_list_cleanup(&list, NULL);
return(1);
}
View
11 list.c
@@ -80,13 +80,10 @@ void owl_list_cleanup(owl_list *l, void (*elefree)(void *))
{
int i;
- for (i=0; i<l->size; i++) {
- (elefree)(l->list[i]);
+ if (elefree) {
+ for (i = 0; i < l->size; i++) {
+ (elefree)(l->list[i]);
+ }
}
owl_free(l->list);
}
-
-void owl_list_free_simple(owl_list *l)
-{
- if (l->list) owl_free(l->list);
-}
View
@@ -962,7 +962,7 @@ void owl_message_free(owl_message *m)
owl_free(p);
}
- owl_list_free_simple(&(m->attributes));
+ owl_list_cleanup(&(m->attributes), NULL);
owl_message_invalidate_format(m);
}
View
@@ -81,7 +81,7 @@ int owl_messagelist_expunge(owl_messagelist *ml)
}
/* free the old list */
- owl_list_free_simple(&(ml->list));
+ owl_list_cleanup(&(ml->list), NULL);
/* copy the new list to the old list */
memcpy(&(ml->list), &newlist, sizeof(owl_list));
View
4 view.c
@@ -37,7 +37,7 @@ void owl_view_recalculate(owl_view *v)
ml=&(v->ml);
/* nuke the old list */
- owl_list_free_simple(&ml->list);
+ owl_list_cleanup(&ml->list, NULL);
owl_messagelist_create(&(v->ml));
/* find all the messages we want */
@@ -158,6 +158,6 @@ const char *owl_view_get_filtname(const owl_view *v)
void owl_view_free(owl_view *v)
{
- owl_list_free_simple(&v->ml.list);
+ owl_list_cleanup(&v->ml.list, NULL);
if (v->name) owl_free(v->name);
}

0 comments on commit 5e5f08f

Please sign in to comment.