weston-log-internal: Allow to hang-off data over the subscription

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 5 years ago
parent 9bb1c3a3c2
commit 410d0bc0b2
  1. 6
      libweston/weston-log-internal.h
  2. 16
      libweston/weston-log.c

@ -102,4 +102,10 @@ weston_vlog(const char *fmt, va_list ap);
int int
weston_vlog_continue(const char *fmt, va_list ap); 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 */ #endif /* WESTON_LOG_INTERNAL_H */

@ -113,6 +113,8 @@ struct weston_log_subscription {
struct weston_log_scope *source; struct weston_log_scope *source;
struct wl_list source_link; /**< weston_log_scope::subscription_list or struct wl_list source_link; /**< weston_log_scope::subscription_list or
weston_log_context::pending_subscription_list */ weston_log_context::pending_subscription_list */
void *data;
}; };
static struct weston_log_subscription * 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. /** Creates a new subscription using the subscriber by \c owner.
* *
* The subscription created is added to the \c owner subscription list. * The subscription created is added to the \c owner subscription list.

Loading…
Cancel
Save