[PATCH] kbproto: typedef instead of #define

Dan Nicholson dbn.lists at gmail.com
Mon Apr 6 20:24:35 PDT 2009


On Mon, Apr 6, 2009 at 6:50 PM, Jeremy Huddleston
<jeremyhu at freedesktop.org> wrote:
>
> On Apr 6, 2009, at 17:34, Jeremy Huddleston wrote:
>> diff --git a/include/X11/Xlib.h b/include/X11/Xlib.h
>> index 44557ea..e134c62 100644
>> --- a/include/X11/Xlib.h
>> +++ b/include/X11/Xlib.h
>> @@ -107,8 +107,8 @@ _Xmblen(
>>
>>  typedef char *XPointer;
>>
>> -#define Bool int
>> -#define Status int
>> +typedef int Bool;
>> +typedef int Status;
>>  #define True 1
>>  #define False 0
>
> Then that screws up when Xdefs.h is included after Xlib.h ... why
> doesn't Xlib.h just #include Xdefs.h to get these?

You can do the same thing as Xdefs.h:

#ifndef Bool
#  ifndef _XTYPEDEF_BOOL
#   define _XTYPEDEF_BOOL
typedef int Bool;
#  endif
#endif

But, yeah, the X headers are nasty. Another question here would be,
why is Status defined in Xlib.h and not X.h or Xdefs.h? Surely it's
not client specific.

--
Dan


More information about the xorg-devel mailing list