On 12/23/2014 04:23 PM, Frank Henigman wrote: > On Tue, Dec 16, 2014 at 3:18 AM, Chad Versace > <[email protected]> wrote: >> When designing the original Waffle 1.0 API, I made a mistake when >> I chose to declare attribute lists as arrays of int32_t. Instead, they >> should have been arrays of intptr_t. >> >> A new public function, waffle_window_create2, will have a `const >> intptr_t attrib_list[]` parameter. Therefore waffle needs intptr_t >> variants of the wcore_attrib_list functions. >> >> Signed-off-by: Chad Versace <[email protected]> >> --- >> src/waffle/core/wcore_attrib_list.c | 73 >> +++++++++++++++++++++++++++++++++++++ >> src/waffle/core/wcore_attrib_list.h | 23 ++++++++++++ >> 2 files changed, 96 insertions(+) >>
>> +bool
>> +wcore_attrib_list_update(
>> + intptr_t *attrib_list,
>> + intptr_t key,
>> + intptr_t value)
>> +{
>> + intptr_t *i = attrib_list;
>> +
>> + if (attrib_list == NULL)
>> + return false;
>> +
>> + while (*i != 0 && *i != key)
>> + i += 2;
>> +
>> + if (*i == key) {
>> + i[1] = value;
>> + return true;
>> + }
>> + else {
>> + return false;
>> + }
>> +}
>
> Speaking of wincing (patch 00/11 thread) this code duplication makes
> me wince. If we really have to keep outside facing int32_t functions,
> can we immediately translate int32_t's passed into them to intptr_t's
> and keep waffle internals all intptr_t? With an eye to deprecating
> the int32_t interfaces?
Yes. This duplication made me wince too.
In v2 of the series, I'll remove the duplication by immediately translating
int32_t lists to intptr_t lists. I'll also follow-up with some deprecation
mechanism for the public waffle_attrib_list functions.
signature.asc
Description: OpenPGP digital signature
_______________________________________________ waffle mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/waffle

