[PATCH:xf86-input-keyboard 07/21] Add translation table for AT/PS2 pseudo XT scancodes.

walter harms wharms at bfs.de
Sun Jul 28 09:13:05 PDT 2013



Am 28.07.2013 15:50, schrieb Thomas Klausner:
> On Sat, Jul 27, 2013 at 11:27:59AM +0200, walter harms wrote:
>>> +#define WS_XT_MAP_SIZE (sizeof(wsXtMap)/sizeof(unsigned char))
>>> +
>>
>> I would be careful here, the type is CARD8, that may be or not
>> size of unsigned char. I prefer using *wsXtMap or wsXtMap[0]
>> that circumvents the problem very nicely.
> 
> I just followed the other examples in the file:
> #define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
> #define WS_XT_MAP_SIZE (sizeof(wsXtMap)/sizeof(unsigned char))
> #define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
> #define WS_LK201_MAP_SIZE (sizeof(wsLk201Map)/sizeof(unsigned char))
> #define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))
> 
> I agree your suggestion is more stable, if something changes.
> 
> Should I change them all to use sizeof(*wsFOOMap) instead?
>  Thomas

I am not the maintainer, i simply review patches.
so i suggest:
1. Go for sizeof(*wsXtMap) in your patch first.
2. check if there is a macro like ARRAY_SIZE(x) (sizeof(x)/sizeof(*x)) (i have no idea ARRAY_SIZE if from linux kernel)
3. Then place ARRAY_SIZE(x) (or what ever name it is)
4. do an other patch

re,
 wh


More information about the xorg-devel mailing list