Skip to content

Commit

Permalink
Made free_event_data() public.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.daper.net/moc/trunk@1688 910807d9-36e0-0310-a014-e9ea483e2ba4
  • Loading branch information
daper committed Sep 30, 2005
1 parent cb96508 commit 5d1366d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
22 changes: 11 additions & 11 deletions protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,17 +533,17 @@ void free_tag_ev_data (struct tag_ev_response *d)
}

/* Free data associated with the event if any. */
static void free_event_data (struct event *e)
void free_event_data (const int type, void *data)
{
if (e->type == EV_PLIST_ADD) {
plist_free_item_fields (e->data);
free (e->data);
if (type == EV_PLIST_ADD) {
plist_free_item_fields ((struct plist_item *)data);
free (data);
}
else if (e->type == EV_FILE_TAGS)
free_tag_ev_data ((struct tag_ev_response *)e->data);
else if (e->type == EV_PLIST_DEL || e->type == EV_STATUS_MSG)
free (e->data);
else if (e->data)
else if (type == EV_FILE_TAGS)
free_tag_ev_data ((struct tag_ev_response *)data);
else if (type == EV_PLIST_DEL || type == EV_STATUS_MSG)
free (data);
else if (data)
abort (); /* BUG */
}

Expand All @@ -555,7 +555,7 @@ void event_queue_free (struct event_queue *q)
assert (q != NULL);

while ((e = event_get_first(q))) {
free_event_data (e);
free_event_data (e->type, e->data);
event_pop (q);
}
}
Expand Down Expand Up @@ -649,7 +649,7 @@ enum noblock_io_status event_send_noblock (int sock, struct event_queue *q)
struct event *e;

e = event_get_first (q);
free_event_data (e);
free_event_data (e->type, e->data);
event_pop (q);

return NB_IO_OK;
Expand Down
1 change: 1 addition & 0 deletions protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ int send_tags (int sock, const struct file_tags *tags);

void event_queue_init (struct event_queue *q);
void event_queue_free (struct event_queue *q);
void free_event_data (const int type, void *data);
struct event *event_get_first (struct event_queue *q);
void event_pop (struct event_queue *q);
void event_push (struct event_queue *q, const int event, void *data);
Expand Down

0 comments on commit 5d1366d

Please sign in to comment.