xserver: Branch 'master' - 2 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 6 21:31:58 UTC 2025
Xext/geext.c | 65 ++++++++++++++++-------------------------------------------
1 file changed, 18 insertions(+), 47 deletions(-)
New commits:
commit 36dd28129b5aa490aa6cbb7748a306193134339c
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Jul 3 19:56:46 2024 +0200
Xext: geext: simplify dispatcher
Most of the complexity here isn't needed at all. It can be really trivial,
since we just have one operation anyways.
It's also much cleaner to use the defines from proto headers instead of
raw numbers.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1596>
diff --git a/Xext/geext.c b/Xext/geext.c
index d2692e261..a1625a54a 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -36,12 +36,6 @@ DevPrivateKeyRec GEClientPrivateKeyRec;
GEExtension GEExtensions[MAXEXTENSIONS];
-/* Major available requests */
-static const int version_requests[] = {
- X_GEQueryVersion, /* before client sends QueryVersion */
- X_GEQueryVersion, /* must be set to last request in version 1 */
-};
-
/* Forward declarations */
static void SGEGenericEvent(xEvent *from, xEvent *to);
@@ -87,11 +81,6 @@ ProcGEQueryVersion(ClientPtr client)
return Success;
}
-static int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
- /* Version 1.0 */
- ProcGEQueryVersion,
-};
-
/************************************************************/
/* swapped request handlers */
/************************************************************/
@@ -99,19 +88,12 @@ static int _X_COLD
SProcGEQueryVersion(ClientPtr client)
{
REQUEST(xGEQueryVersionReq);
-
- swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
- return (*ProcGEVector[stuff->ReqType]) (client);
+ return SProcGEQueryVersion(client);
}
-static int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
- /* Version 1.0 */
- SProcGEQueryVersion
-};
-
/************************************************************/
/* callbacks */
/************************************************************/
@@ -120,32 +102,29 @@ static int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
static int
ProcGEDispatch(ClientPtr client)
{
- GEClientInfoPtr pGEClient = GEGetClient(client);
+ REQUEST(xReq);
- REQUEST(xGEReq);
-
- if (pGEClient->major_version >= ARRAY_SIZE(version_requests))
- return BadRequest;
- if (stuff->ReqType > version_requests[pGEClient->major_version])
+ switch (stuff->data) {
+ case X_GEQueryVersion:
+ return ProcGEQueryVersion(client);
+ default:
return BadRequest;
-
- return (ProcGEVector[stuff->ReqType]) (client);
+ }
}
/* dispatch swapped requests */
static int _X_COLD
SProcGEDispatch(ClientPtr client)
{
- GEClientInfoPtr pGEClient = GEGetClient(client);
-
- REQUEST(xGEReq);
+ REQUEST(xReq);
+ swaps(&stuff->length);
- if (pGEClient->major_version >= ARRAY_SIZE(version_requests))
- return BadRequest;
- if (stuff->ReqType > version_requests[pGEClient->major_version])
+ switch (stuff->data) {
+ case X_GEQueryVersion:
+ return SProcGEQueryVersion(client);
+ default:
return BadRequest;
-
- return (*SProcGEVector[stuff->ReqType]) (client);
+ }
}
/* Reset extension. Called on server shutdown. */
commit 6df7ba38ae020b27755e972bf240d8a92f510546
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Jul 3 22:14:06 2024 +0200
Xext: geext: drop unused variable extEntry
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1596>
diff --git a/Xext/geext.c b/Xext/geext.c
index 68d900408..d2692e261 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -184,24 +184,16 @@ SGEGenericEvent(xEvent *from, xEvent *to)
void
GEExtensionInit(void)
{
- ExtensionEntry *extEntry;
-
if (!dixRegisterPrivateKey
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
- if ((extEntry = AddExtension(GE_NAME,
- 0, GENumberErrors,
- ProcGEDispatch, SProcGEDispatch,
- GEResetProc, StandardMinorOpcode)) != 0) {
- memset(GEExtensions, 0, sizeof(GEExtensions));
-
- EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
- }
- else {
+ if (!AddExtension(GE_NAME, 0, GENumberErrors, ProcGEDispatch, SProcGEDispatch,
+ GEResetProc, StandardMinorOpcode))
FatalError("GEInit: AddExtensions failed.\n");
- }
+ memset(GEExtensions, 0, sizeof(GEExtensions));
+ EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
/************************************************************/
More information about the xorg-commit
mailing list