Skip to content
  • Pekka Paalanen's avatar
    xwm: clarify props[] in weston_wm_window_read_properties() · 20111d5d
    Pekka Paalanen authored
    
    
    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: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
    Reviewed-by: default avatarQuentin Glidic <sardemff7+git@sardemff7.net>
    20111d5d