[PATCH weston 08/15] libweston: move asserts to add_pending_output()

Armin Krezović krezovic.armin at gmail.com
Tue Apr 4 19:50:11 UTC 2017


On 04.04.2017 12:58, Pekka Paalanen wrote:
> From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> 
> weston_compositor_add_pending_output() is the point through which all
> backends must go when creating a new output. The enable and disable
> vfuns are essential for anything to be done with the output, so it makes
> sense to check them here, rather than when actually enabling or
> disabling.
> 
> Particularly the disable vfunc is rarely called, so this gets the check
> better excercised.
> 
> Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Makes sense.

Reviewed-by: Armin Krezović <krezovic.armin at gmail.com>

Thanks, Armin.

> ---
>  libweston/compositor.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index baa4176..4e6d9f7 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -4698,6 +4698,9 @@ WL_EXPORT void
>  weston_compositor_add_pending_output(struct weston_output *output,
>  				     struct weston_compositor *compositor)
>  {
> +	assert(output->disable);
> +	assert(output->enable);
> +
>  	wl_list_remove(&output->link);
>  	wl_list_insert(compositor->pending_output_list.prev, &output->link);
>  	wl_signal_emit(&compositor->output_pending_signal, output);
> @@ -4742,8 +4745,6 @@ weston_output_enable(struct weston_output *output)
>  	struct weston_output *iterator;
>  	int x = 0, y = 0;
>  
> -	assert(output->enable);
> -
>  	iterator = container_of(c->output_list.prev,
>  				struct weston_output, link);
>  
> @@ -4830,8 +4831,6 @@ weston_output_enable(struct weston_output *output)
>  WL_EXPORT void
>  weston_output_disable(struct weston_output *output)
>  {
> -	assert(output->disable);
> -
>  	/* Should we rename this? */
>  	output->destroying = 1;
>  
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 870 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170404/21c1e7f0/attachment.sig>


More information about the wayland-devel mailing list