diff --git a/src/libeis-event.c b/src/libeis-event.c index d073035..ddf4095 100644 --- a/src/libeis-event.c +++ b/src/libeis-event.c @@ -118,9 +118,8 @@ eis_event_new_for_device(struct eis_device *device) return e; } -/* this one is not public */ +_public_ OBJECT_IMPLEMENT_REF(eis_event); - _public_ OBJECT_IMPLEMENT_UNREF_CLEANUP(eis_event); _public_ diff --git a/src/libeis-event.h b/src/libeis-event.h index b01aeed..9754d22 100644 --- a/src/libeis-event.h +++ b/src/libeis-event.h @@ -83,6 +83,3 @@ eis_event_new_for_device(struct eis_device *device); struct eis * eis_event_get_context(struct eis_event *event); - -struct eis_event* -eis_event_ref(struct eis_event *event); diff --git a/src/libeis.h b/src/libeis.h index 6a0600a..d593d4f 100644 --- a/src/libeis.h +++ b/src/libeis.h @@ -674,13 +674,24 @@ struct eis_event * eis_peek_event(struct eis *eis); /** - * Release resources associated with this event. This function always - * returns NULL. + * Increase the refcount of this struct by one. Use eis_event_unref() to decrease + * the refcount. This function always returns the same event that the reference + * was added to. * - * The caller cannot increase the refcount of an event. Events should be - * considered transient data and not be held longer than required. - * eis_event_unref() is provided for consistency (as opposed to, say, - * eis_event_free()). + * Events should be considered transient data and not be held longer than + * required. + */ +struct eis_event * +eis_event_ref(struct eis_event *event); + +/** + * Decrease the refcount of this struct by one. When the refcount reaches + * zero, all allocated resources for this struct are released. + * + * Events should be considered transient data and not be held longer than + * required. + * + * @return always NULL */ struct eis_event * eis_event_unref(struct eis_event *event);