libweston: weston_output_init(..., +name)
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 3 Apr 2017 10:18:13 +0000 (13:18 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 4 Oct 2017 13:17:41 +0000 (16:17 +0300)
commit26ac2e12189c93d7e01aace7c4a702b77e519a90
tree3990df7fd84255f5fedf3ead81dd5319c1770c46
parentd05a8192527cc85c2ae86f823581872722386214
libweston: weston_output_init(..., +name)

Add 'name' argument to weston_output_init(). This is much more obvious
than the assert inside weston_output_init() to ensure the caller has set
a field in weston_output first.

Now weston_output_init() will strdup() the name itself, which means we
can drop a whole bunch of strdup()s in the backends. This matches
weston_output_destroy() which was already calling free() on the name.

All backends are slightly reordered to call weston_output_init() before
accessing any fields of weston_output, except the Wayland backend which
would make it a little awkward to do it in this patch. Mind, that
weston_output_init() still does not reset the struct to zero - it is
presumed the caller has done it, since weston_output is embedded in the
backend output structs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
[Daniel: document name copying]
Acked-by Daniel Stone <daniels@collabora.com>
libweston/compositor-drm.c
libweston/compositor-fbdev.c
libweston/compositor-headless.c
libweston/compositor-rdp.c
libweston/compositor-wayland.c
libweston/compositor-x11.c
libweston/compositor.c
libweston/compositor.h