From c61ac23f244899e68e77bf0381eb477a77a28740 Mon Sep 17 00:00:00 2001
From: Ulrich Sibiller <uli42@gmx.de>
Date: Fri, 3 May 2019 23:50:45 +0200
Subject: NXdispatch.c: simplify InitClientPrivates()

by calling the upstream function from dix/dispatch.c
---
 nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 42 ++++++-------------------
 1 file changed, 9 insertions(+), 33 deletions(-)

(limited to 'nx-X11/programs/Xserver/hw/nxagent')

diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
index c427c05f2..ace2941b1 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
@@ -1115,41 +1115,17 @@ CloseDownClient(register ClientPtr client)
 int
 InitClientPrivates(ClientPtr client)
 {
-    register char *ptr;
-    DevUnion *ppriv;
-    register unsigned *sizes;
-    register unsigned size;
-    register int i;
-
-    if (totalClientSize == sizeof(ClientRec))
-	ppriv = (DevUnion *)NULL;
-    else if (client->index)
-	ppriv = (DevUnion *)(client + 1);
-    else
-    {
-	ppriv = (DevUnion *)malloc(totalClientSize - sizeof(ClientRec));
-	if (!ppriv)
-	    return 0;
-    }
-    client->devPrivates = ppriv;
-    sizes = clientPrivateSizes;
-    ptr = (char *)(ppriv + clientPrivateLen);
-    for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++)
+    int ret = xorg_InitClientPrivates(client);
+
+    if (ret == 1)
     {
-	if ( (size = *sizes) )
-	{
-	    ppriv->ptr = (void *)ptr;
-	    ptr += size;
-	}
-	else
-	    ppriv->ptr = (void *)NULL;
-    }
 
-    /*
-     * Initialize the private members.
-     */
+      /*
+       * Initialize the private members.
+       */
 
-    nxagentInitClientPrivates(client);
+      nxagentInitClientPrivates(client);
+    }
 
-    return 1;
+    return ret;
 }
-- 
cgit v1.2.3