weston-log: share code between weston_log_scope_destroy() and weston_log_subscriber_release()
Both weston_log_scope_destroy() and weston_log_subscriber_release() have calls for destroy_subscription(). We can move this call to weston_log_subscription_destroy() without losing anything and avoiding repetition. Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
This commit is contained in:
committed by
Pekka Paalanen
parent
23491cd931
commit
97d2d69909
+5
-13
@@ -279,6 +279,9 @@ weston_log_subscription_destroy(struct weston_log_subscription *sub)
|
|||||||
{
|
{
|
||||||
assert(sub);
|
assert(sub);
|
||||||
|
|
||||||
|
if (sub->owner->destroy_subscription)
|
||||||
|
sub->owner->destroy_subscription(sub->owner);
|
||||||
|
|
||||||
if (sub->source->destroy_subscription)
|
if (sub->source->destroy_subscription)
|
||||||
sub->source->destroy_subscription(sub, sub->source->user_data);
|
sub->source->destroy_subscription(sub, sub->source->user_data);
|
||||||
|
|
||||||
@@ -710,13 +713,8 @@ weston_log_scope_destroy(struct weston_log_scope *scope)
|
|||||||
if (!scope)
|
if (!scope)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wl_list_for_each_safe(sub, sub_tmp, &scope->subscription_list, source_link) {
|
wl_list_for_each_safe(sub, sub_tmp, &scope->subscription_list, source_link)
|
||||||
/* destroy each subscription */
|
|
||||||
if (sub->owner->destroy_subscription)
|
|
||||||
sub->owner->destroy_subscription(sub->owner);
|
|
||||||
|
|
||||||
weston_log_subscription_destroy(sub);
|
weston_log_subscription_destroy(sub);
|
||||||
}
|
|
||||||
|
|
||||||
wl_list_remove(&scope->compositor_link);
|
wl_list_remove(&scope->compositor_link);
|
||||||
free(scope->name);
|
free(scope->name);
|
||||||
@@ -944,14 +942,8 @@ weston_log_subscriber_release(struct weston_log_subscriber *subscriber)
|
|||||||
{
|
{
|
||||||
struct weston_log_subscription *sub, *sub_tmp;
|
struct weston_log_subscription *sub, *sub_tmp;
|
||||||
|
|
||||||
wl_list_for_each_safe(sub, sub_tmp, &subscriber->subscription_list, owner_link) {
|
wl_list_for_each_safe(sub, sub_tmp, &subscriber->subscription_list, owner_link)
|
||||||
/* destroy each subscription */
|
|
||||||
if (sub->owner->destroy_subscription)
|
|
||||||
sub->owner->destroy_subscription(sub->owner);
|
|
||||||
|
|
||||||
weston_log_subscription_destroy(sub);
|
weston_log_subscription_destroy(sub);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destroy a file type or a flight-rec type subscriber.
|
/** Destroy a file type or a flight-rec type subscriber.
|
||||||
|
|||||||
Reference in New Issue
Block a user