Configuration files (Re: [PATCH] strtol() fails on 32 bit...)

Kristian Høgsberg krh at
Mon Jan 30 06:35:03 PST 2012

2012/1/30 Pekka Paalanen <ppaalanen at>:
> On Fri, 27 Jan 2012 11:27:48 -0500
> Kristian Høgsberg <krh at> wrote:
>> On Fri, Jan 27, 2012 at 10:53 AM, Scott Moreau <oreaus at> wrote:
>> > ---
>> > I'm not sure this is the correct fix but if nothing else, this can serve as a bug report until the tracker is up. The problem is that config-parser sets variables to incorrect values on 32 bit systems which causes problems. Specifically, this fixes a bug where the background color value is wrong. Sometimes alpha is not 1 and it leaves ghost trails for any movement.
>> Ah, yes.  A better fix would be to add a CONFIG_KEY_UNSIGNED_INTEGER
>> type and handle the conversion with strtoul instead.
> I'm sceptical about the whole idea of expressing an ARGB tuplet as a
> single integer because of possible endianness issues.

There's no endian issue here: we parse the integer and shift down the
a, r, g and b components.  If we accessed by casting to unsigned char
* and indexing we'd be in trouble.  Representing colors as 8 digit hex
numbers is at least pretty common (thanks to the web and css), but
perhaps not intuitive.

> I understand it is convenient for now, and the config parser is not
> supposed to grow into a full-featured config system. Should we consider
> starting to use a proper configuration library, whatever that might be?
> Maybe it could be a newbie task to find and integrate one?
> To add to Vignatti's blog list of tasks. ;-)

I'm carefully trying to keep weston neutral and free of dependencies.
Mainly "political" dependencies that would put weston in one of the
"open source silos", but I also don't want esoteric/little know
libraries on the dependency list.  And while I'm on my soap box, code
reuse is overrated.  Unless a library is solving a big problem for is,
in the right way, it's not worth the cost of taking the extra
dependency and shoe-horning your problem into somebody else solution.

Recommended reading:


More information about the wayland-devel mailing list