diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-04-07 08:43:13 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-04-07 12:45:55 +1000 |
commit | 7aad7dbf409eaa16a2c80d76ba2a42dc84501919 (patch) | |
tree | 3315bafcf958b1318cb20651a53075c4b7f4de0f | |
parent | b28a1af55cf1ad2a882cc8cd73b77341dec7ff5a (diff) |
Xext: use EXT_MASK macro instead of manual & 0x7f
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | Xext/geext.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Xext/geext.c b/Xext/geext.c index a6fbb0947..18f8ffeac 100644 --- a/Xext/geext.c +++ b/Xext/geext.c @@ -49,6 +49,7 @@ static const int version_requests[] = { static void SGEGenericEvent(xEvent* from, xEvent* to); #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) +#define EXT_MASK(ext) ((ext) & 0x7F) /************************************************************/ /* request handlers */ @@ -191,8 +192,8 @@ SGEGenericEvent(xEvent* from, xEvent* to) return; } - if (GEExtensions[gefrom->extension & 0x7F].evswap) - GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto); + if (GEExtensions[EXT_MASK(gefrom->extension)].evswap) + GEExtensions[EXT_MASK(gefrom->extension)].evswap(gefrom, geto); } /* Init extension, register at server. @@ -241,11 +242,11 @@ void GERegisterExtension(int extension, void (*ev_swap)(xGenericEvent* from, xGenericEvent* to)) { - if ((extension & 0x7F) >= MAXEXTENSIONS) + if (EXT_MASK(extension) >= MAXEXTENSIONS) FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n"); /* extension opcodes are > 128, might as well save some space here */ - GEExtensions[extension & 0x7f].evswap = ev_swap; + GEExtensions[EXT_MASK(extension)].evswap = ev_swap; } |