xwm: clarify props[] in weston_wm_window_read_properties()
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 1 Dec 2016 15:07:12 +0000 (17:07 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 17 Jan 2017 14:35:35 +0000 (16:35 +0200)
commit20111d5d530ce1a20b017a92a85f512ded65fed7
tree56eef208d821775f1be24438ce2da4243a8922ff
parent505237e9f8a5b2ce1186a7b3ade544fbb235ec43
xwm: clarify props[] in weston_wm_window_read_properties()

The props array contained offsets to struct members. It is convenient
for writing static const arrays as you only store a constant offset and
compute the pointer later. However, the array was not static to begin
with, the atoms are not build time constants. We can as well just store
the pointer directly in the array.

Entries that did not use the offset had bogus offsets, producing
pointers to arbitrary fields. They are changed to have a NULL pointer.
If the code unintentionally used the pointer, it will now explode rather
than corrupt memory.

Also explain the use of the #defined constants and #undef them when they
get out of scope. This clearly documents that they are just a convenient
hack to avoid lots of special cases in the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
xwayland/window-manager.c