summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--events.c11
-rw-r--r--events.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/events.c b/events.c
index dba054a..90d81c3 100644
--- a/events.c
+++ b/events.c
@@ -181,3 +181,14 @@ void events_init(struct events *events)
events->maxfd = 0;
list_init(&events->events);
}
+
+void events_cleanup(struct events *events)
+{
+ while (!list_empty(&events->events)) {
+ struct event_fd *event;
+
+ event = list_first_entry(&events->events, typeof(*event), list);
+ list_remove(&event->list);
+ free(event);
+ }
+}
diff --git a/events.h b/events.h
index ef8dccc..b0b8fa8 100644
--- a/events.h
+++ b/events.h
@@ -44,5 +44,6 @@ bool events_loop(struct events *events);
void events_stop(struct events *events);
void events_init(struct events *events);
+void events_cleanup(struct events *events);
#endif