[PATCH 00/37] Warning fixes (post 1.15 proposed changes)
Mouse
mouse at Rodents-Montreal.ORG
Wed Nov 20 20:03:34 PST 2013
> The issue is that different parts of the X server use either const
> values or allocated values and store those in the same structure
> members. Each part "knows" what it has done; const values are
> "never" freed, while allocated values "always" are.
> So, we have three choices:
> 1) Stick casts where constant strings are assigned to non-const
> members
> 2) Copy constant strings, and then figure out where to free them
> reliably
> 3) Stick casts where non-constant strings are freed from const
> members.
I'm not clear why
4) add a second pointer, so the to-use pointer can be consted and the
to-free pointer non-consted
isn't an option. I'm hardly wedded to the tactic - if it's not an
option, that's fine - but I don't see any reason why it wouldn't work.
> 2) is the 'most correct', and would eliminate all casts,
I think this (4) is equally correct and also eliminates all (relevant)
casts. It's _almost_ as good in terms of CPU cycles as (1) or (3) -
the additional cost is just that of a second store whenever the value
is changed - and its major price is duplication of each affected
pointer in its containing data structure.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
More information about the xorg-devel
mailing list