weston-log: merge functions that destroy different types of subscribers

Log subscriber API is not type-safe. File and flight recorder
subscribers are created with functions that return
weston_log_subscriber objects. But there's a problem: to destroy
these objects you have to call the right function for each type
of subscriber, and a user calling the wrong destroy function
wouldn't get a warning.

Merge functions that destroy different types of subscribers, making
the log subscriber API type-safe.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
This commit is contained in:
Leandro Ribeiro
2020-02-06 16:43:51 -03:00
committed by Pekka Paalanen
parent 8c02ea1069
commit 1ded661aac
7 changed files with 49 additions and 45 deletions
+3 -6
View File
@@ -110,6 +110,9 @@ char *
weston_log_scope_timestamp(struct weston_log_scope *scope,
char *buf, size_t len);
void
weston_log_subscriber_destroy(struct weston_log_subscriber *subscriber);
void
weston_log_subscribe(struct weston_log_context *log_ctx,
struct weston_log_subscriber *subscriber,
@@ -118,15 +121,9 @@ weston_log_subscribe(struct weston_log_context *log_ctx,
struct weston_log_subscriber *
weston_log_subscriber_create_log(FILE *dump_to);
void
weston_log_subscriber_destroy_log(struct weston_log_subscriber *sub);
struct weston_log_subscriber *
weston_log_subscriber_create_flight_rec(size_t size);
void
weston_log_subscriber_destroy_flight_rec(struct weston_log_subscriber *sub);
void
weston_log_subscriber_display_flight_rec(struct weston_log_subscriber *sub);