diff options
-rw-r--r-- | src/afb-evt.c | 8 | ||||
-rw-r--r-- | src/afb-evt.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/afb-evt.c b/src/afb-evt.c index a99dc894..53ab0e0b 100644 --- a/src/afb-evt.c +++ b/src/afb-evt.c @@ -205,6 +205,14 @@ struct afb_event afb_evt_create_event(const char *name) } /* + * Returns the name of the 'event' + */ +const char *afb_evt_event_name(struct afb_event event) +{ + return (event.itf != &afb_evt_event_itf) ? NULL : ((struct afb_evt_event *)event.closure)->name; +} + +/* * Returns an instance of the listener defined by the 'send' callback * and the 'closure'. * Returns NULL in case of memory depletion. diff --git a/src/afb-evt.h b/src/afb-evt.h index 8e102546..157a7776 100644 --- a/src/afb-evt.h +++ b/src/afb-evt.h @@ -30,6 +30,7 @@ extern struct afb_evt_listener *afb_evt_listener_addref(struct afb_evt_listener extern void afb_evt_listener_unref(struct afb_evt_listener *listener); extern struct afb_event afb_evt_create_event(const char *name); +extern const char *afb_evt_event_name(struct afb_event event); extern int afb_evt_add_watch(struct afb_evt_listener *listener, struct afb_event event); extern int afb_evt_remove_watch(struct afb_evt_listener *listener, struct afb_event event); |