[PATCH] Guard x* macros with _HAVE_XALLOC_DECLS as well to avoid clashes with Xlib

Mikhail Gusarov dottedmag at dottedmag.net
Sat Jun 19 14:53:27 PDT 2010


If Xlib headers are included before os.h declaration of Xcalloc clashes with
definition of Xcalloc macros from there (e.g. in Xephyr).

Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 include/os.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/os.h b/include/os.h
index efa202c..cd21d3c 100644
--- a/include/os.h
+++ b/include/os.h
@@ -67,6 +67,7 @@ SOFTWARE.
 typedef struct _FontPathRec *FontPathPtr;
 typedef struct _NewClientRec *NewClientPtr;
 
+#ifndef _HAVE_XALLOC_DECLS
 #ifndef xalloc
 #define xnfalloc(size) XNFalloc((unsigned long)(size))
 #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
@@ -79,6 +80,7 @@ typedef struct _NewClientRec *NewClientPtr;
 #define xstrdup(s) Xstrdup(s)
 #define xnfstrdup(s) XNFstrdup(s)
 #endif
+#endif
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -213,7 +215,6 @@ extern _X_EXPORT int set_font_authorizations(
     pointer /* client */);
 
 #ifndef _HAVE_XALLOC_DECLS
-#define _HAVE_XALLOC_DECLS
 
 /*
  * Use malloc(3) instead.
-- 
1.7.1



More information about the xorg-devel mailing list