[PATCH xserver] dix: Remove pointless client-state callbacks

Adam Jackson ajax at redhat.com
Mon Apr 18 16:56:17 UTC 2016


Private storage is pre-zeroed by the private system itself.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 Xext/geext.c          | 22 ----------------------
 Xi/extinit.c          | 15 ---------------
 composite/compext.c   | 14 --------------
 damageext/damageext.c | 23 +----------------------
 render/render.c       | 13 -------------
 xfixes/xfixes.c       | 21 +--------------------
 6 files changed, 2 insertions(+), 106 deletions(-)

diff --git a/Xext/geext.c b/Xext/geext.c
index 6285f69..6312f24 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -145,28 +145,10 @@ SProcGEDispatch(ClientPtr client)
     return (*SProcGEVector[stuff->ReqType]) (client);
 }
 
-/**
- * Called when a new client inits a connection to the X server.
- *
- * We alloc a simple struct to store the client's major/minor version. Can be
- * used in the furture for versioning support.
- */
-static void
-GEClientCallback(CallbackListPtr *list, void *closure, void *data)
-{
-    NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
-    ClientPtr pClient = clientinfo->client;
-    GEClientInfoPtr pGEClient = GEGetClient(pClient);
-
-    pGEClient->major_version = 0;
-    pGEClient->minor_version = 0;
-}
-
 /* Reset extension. Called on server shutdown. */
 static void
 GEResetProc(ExtensionEntry * extEntry)
 {
-    DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
     EventSwapVector[GenericEvent] = NotImplemented;
 }
 
@@ -205,10 +187,6 @@ GEExtensionInit(void)
         (&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
         FatalError("GEExtensionInit: GE private request failed.\n");
 
-    if (!AddCallback(&ClientStateCallback, GEClientCallback, 0)) {
-        FatalError("GEExtensionInit: register client callback failed.\n");
-    }
-
     if ((extEntry = AddExtension(GE_NAME,
                                  0, GENumberErrors,
                                  ProcGEDispatch, SProcGEDispatch,
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 26c628c..48edf38 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -380,18 +380,6 @@ DevPrivateKeyRec XIClientPrivateKeyRec;
  *
  */
 
-static void
-XIClientCallback(CallbackListPtr *list, void *closure, void *data)
-{
-    NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
-    ClientPtr pClient = clientinfo->client;
-    XIClientPtr pXIClient;
-
-    pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
-    pXIClient->major_version = 0;
-    pXIClient->minor_version = 0;
-}
-
 /*************************************************************************
  *
  * ProcIDispatch - main dispatch routine for requests to this extension.
@@ -1296,9 +1284,6 @@ XInputExtensionInit(void)
         (&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
         FatalError("Cannot request private for XI.\n");
 
-    if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
-        FatalError("Failed to add callback to XI.\n");
-
     if (!XIBarrierInit())
         FatalError("Could not initialize barriers.\n");
 
diff --git a/composite/compext.c b/composite/compext.c
index f1a8255..b95bf99 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -66,17 +66,6 @@ typedef struct _CompositeClient {
 #define GetCompositeClient(pClient) ((CompositeClientPtr) \
     dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
 
-static void
-CompositeClientCallback(CallbackListPtr *list, void *closure, void *data)
-{
-    NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
-    ClientPtr pClient = clientinfo->client;
-    CompositeClientPtr pCompositeClient = GetCompositeClient(pClient);
-
-    pCompositeClient->major_version = 0;
-    pCompositeClient->minor_version = 0;
-}
-
 static int
 FreeCompositeClientWindow(void *value, XID ccwid)
 {
@@ -580,9 +569,6 @@ CompositeExtensionInit(void)
                                sizeof(CompositeClientRec)))
         return;
 
-    if (!AddCallback(&ClientStateCallback, CompositeClientCallback, 0))
-        return;
-
     for (s = 0; s < screenInfo.numScreens; s++)
         if (!compScreenInit(screenInfo.screens[s]))
             return;
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 886f56d..86b54ee 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -568,24 +568,6 @@ SProcDamageDispatch(ClientPtr client)
     return (*SProcDamageVector[stuff->damageReqType]) (client);
 }
 
-static void
-DamageClientCallback(CallbackListPtr *list, void *closure, void *data)
-{
-    NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
-    ClientPtr pClient = clientinfo->client;
-    DamageClientPtr pDamageClient = GetDamageClient(pClient);
-
-    pDamageClient->critical = 0;
-    pDamageClient->major_version = 0;
-    pDamageClient->minor_version = 0;
-}
-
- /*ARGSUSED*/ static void
-DamageResetProc(ExtensionEntry * extEntry)
-{
-    DeleteCallback(&ClientStateCallback, DamageClientCallback, 0);
-}
-
 static int
 FreeDamageExt(void *value, XID did)
 {
@@ -757,13 +739,10 @@ DamageExtensionInit(void)
         (&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec)))
         return;
 
-    if (!AddCallback(&ClientStateCallback, DamageClientCallback, 0))
-        return;
-
     if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents,
                                  XDamageNumberErrors,
                                  ProcDamageDispatch, SProcDamageDispatch,
-                                 DamageResetProc, StandardMinorOpcode)) != 0) {
+                                 NULL, StandardMinorOpcode)) != 0) {
         DamageReqCode = (unsigned char) extEntry->base;
         DamageEventBase = extEntry->eventBase;
         EventSwapVector[DamageEventBase + XDamageNotify] =
diff --git a/render/render.c b/render/render.c
index b777991..b9a932e 100644
--- a/render/render.c
+++ b/render/render.c
@@ -219,17 +219,6 @@ typedef struct _RenderClient {
 
 #define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey))
 
-static void
-RenderClientCallback(CallbackListPtr *list, void *closure, void *data)
-{
-    NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
-    ClientPtr pClient = clientinfo->client;
-    RenderClientPtr pRenderClient = GetRenderClient(pClient);
-
-    pRenderClient->major_version = 0;
-    pRenderClient->minor_version = 0;
-}
-
 #ifdef PANORAMIX
 RESTYPE XRT_PICTURE;
 #endif
@@ -246,8 +235,6 @@ RenderExtensionInit(void)
     if (!dixRegisterPrivateKey
         (&RenderClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RenderClientRec)))
         return;
-    if (!AddCallback(&ClientStateCallback, RenderClientCallback, 0))
-        return;
 
     extEntry = AddExtension(RENDER_NAME, 0, RenderNumberErrors,
                             ProcRenderDispatch, SProcRenderDispatch,
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 3307f87..8d1bd4c 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -212,23 +212,6 @@ SProcXFixesDispatch(ClientPtr client)
     return (*SProcXFixesVector[stuff->xfixesReqType]) (client);
 }
 
-static void
-XFixesClientCallback(CallbackListPtr *list, void *closure, void *data)
-{
-    NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
-    ClientPtr pClient = clientinfo->client;
-    XFixesClientPtr pXFixesClient = GetXFixesClient(pClient);
-
-    pXFixesClient->major_version = 0;
-    pXFixesClient->minor_version = 0;
-}
-
- /*ARGSUSED*/ static void
-XFixesResetProc(ExtensionEntry * extEntry)
-{
-    DeleteCallback(&ClientStateCallback, XFixesClientCallback, 0);
-}
-
 void
 XFixesExtensionInit(void)
 {
@@ -237,14 +220,12 @@ XFixesExtensionInit(void)
     if (!dixRegisterPrivateKey
         (&XFixesClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XFixesClientRec)))
         return;
-    if (!AddCallback(&ClientStateCallback, XFixesClientCallback, 0))
-        return;
 
     if (XFixesSelectionInit() && XFixesCursorInit() && XFixesRegionInit() &&
         (extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents,
                                  XFixesNumberErrors,
                                  ProcXFixesDispatch, SProcXFixesDispatch,
-                                 XFixesResetProc, StandardMinorOpcode)) != 0) {
+                                 NULL, StandardMinorOpcode)) != 0) {
         XFixesReqCode = (unsigned char) extEntry->base;
         XFixesEventBase = extEntry->eventBase;
         XFixesErrorBase = extEntry->errorBase;
-- 
2.7.3



More information about the xorg-devel mailing list