[PATCH] include: document _XkbErrCode2 macros

Peter Hutterer peter.hutterer at who-t.net
Wed Jun 20 18:25:24 PDT 2012

Why sending the number of the (implementation-dependent) error statement to
the client is a good idea is a bit beyond me, but at least document it so we
can all share the despair.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Yes, this is really how it's used in the XKB code.

 include/xkbsrv.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 3b72885..e625282 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -301,6 +301,11 @@ extern _X_EXPORT const char *XkbBinDirectory;
 extern _X_EXPORT CARD32 xkbDebugFlags;
 #define	_XkbLibError(c,l,d)     /* Epoch fail */
+/* "a" is a "unique" numeric identifier that just defines which error
+ * code statement it is. _XkbErrCode2(4, foo) means "this is the 4th error
+ * statement in this function". lovely.
+ */
 #define	_XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
 #define	_XkbErrCode3(a,b,c)	_XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
 #define	_XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))

More information about the xorg-devel mailing list