From 40e39840921ac4141362a76e67f50ed39fb6ff72 Mon Sep 17 00:00:00 2001
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Date: Tue, 28 Jun 2016 16:55:26 +0200
Subject: nx-X11/include/extensions/XKBsrv.h: Different memory handling when
 built with Xserver and with Xlib.

---
 nx-X11/include/extensions/XKBsrv.h | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/nx-X11/include/extensions/XKBsrv.h b/nx-X11/include/extensions/XKBsrv.h
index 3d335bc88..18d90f1e3 100644
--- a/nx-X11/include/extensions/XKBsrv.h
+++ b/nx-X11/include/extensions/XKBsrv.h
@@ -299,16 +299,32 @@ extern void *	XkbLastRepeatEvent;
 extern CARD32	xkbDebugFlags;
 extern CARD32	xkbDebugCtrls;
 
-#define	_XkbAlloc(s)		xalloc((s))
+#ifndef XKB_IN_SERVER
+
+#define	_XkbAlloc(s)		Xalloc((s))
 #define	_XkbCalloc(n,s)		Xcalloc((n)*(s))
 #define	_XkbRealloc(o,s)	Xrealloc((o),(s))
-#define	_XkbTypedAlloc(t)	((t *)xalloc(sizeof(t)))
+#define	_XkbTypedAlloc(t)	((t *)Xalloc(sizeof(t)))
 #define	_XkbTypedCalloc(n,t)	((t *)Xcalloc((n)*sizeof(t)))
 #define	_XkbTypedRealloc(o,n,t) \
 	((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
 #define	_XkbClearElems(a,f,l,t)	bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
 #define	_XkbFree(p)		Xfree(p)
 
+#else
+
+#define	_XkbAlloc(s)		malloc((s))
+#define	_XkbCalloc(n,s)		calloc((n), (s))
+#define	_XkbRealloc(o,s)	realloc((o),(s))
+#define	_XkbTypedAlloc(t)	((t *)malloc(sizeof(t)))
+#define	_XkbTypedCalloc(n,t)	((t *)calloc((n), sizeof(t)))
+#define	_XkbTypedRealloc(o,n,t) \
+	((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
+#define	_XkbClearElems(a,f,l,t)	bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
+#define	_XkbFree(p)		free(p)
+
+#endif /* !XKB_IN_SERVER */
+
 #define	_XkbLibError(c,l,d) \
 	{ _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); }
 #define	_XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
-- 
cgit v1.2.3