From f523ebb5492a2e12b76a8b5b7f1b0e5efd4a8040 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 18 Apr 2016 12:56:17 -0400 Subject: [PATCH] dix: Remove pointless client-state callbacks Private storage is pre-zeroed by the private system itself. Signed-off-by: Adam Jackson Reviewed-by: Eric Anholt --- 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 6285f69f7..6312f248b 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 75f383238..7a86ee2e7 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. @@ -1298,9 +1286,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 f1a825573..b95bf999e 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 886f56d9e..86b54eef4 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 b777991d0..b9a932ee3 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 3307f874b..8d1bd4cc6 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;