weston-log-internal: Allow to hang-off data over the subscription
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
@@ -102,4 +102,10 @@ weston_vlog(const char *fmt, va_list ap);
|
||||
int
|
||||
weston_vlog_continue(const char *fmt, va_list ap);
|
||||
|
||||
void *
|
||||
weston_log_subscription_get_data(struct weston_log_subscription *sub);
|
||||
|
||||
void
|
||||
weston_log_subscription_set_data(struct weston_log_subscription *sub, void *data);
|
||||
|
||||
#endif /* WESTON_LOG_INTERNAL_H */
|
||||
|
||||
@@ -113,6 +113,8 @@ struct weston_log_subscription {
|
||||
struct weston_log_scope *source;
|
||||
struct wl_list source_link; /**< weston_log_scope::subscription_list or
|
||||
weston_log_context::pending_subscription_list */
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
static struct weston_log_subscription *
|
||||
@@ -208,6 +210,20 @@ weston_log_subscription_vprintf(struct weston_log_subscription *sub,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
weston_log_subscription_set_data(struct weston_log_subscription *sub, void *data)
|
||||
{
|
||||
/* don't allow data to already be set */
|
||||
assert(!sub->data);
|
||||
sub->data = data;
|
||||
}
|
||||
|
||||
void *
|
||||
weston_log_subscription_get_data(struct weston_log_subscription *sub)
|
||||
{
|
||||
return sub->data;
|
||||
}
|
||||
|
||||
/** Creates a new subscription using the subscriber by \c owner.
|
||||
*
|
||||
* The subscription created is added to the \c owner subscription list.
|
||||
|
||||
Reference in New Issue
Block a user