From f44e0af4daaad5b18d79f2076bc98d6e79f638af Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 16 Jun 2017 15:44:42 -0400 Subject: [PATCH] dix: Remove extension aliases This appears to be essentially unused. The only known client-side library for the SELinux extension is xcb, which does not look for the name "Flask". The "SGI-GLX" alias for GLX appears to be a bit of superstition at this point, NVIDIA's driver does not expose it and Mesa does not check for it. Signed-off-by: Adam Jackson Acked-by: Keith Packard --- Xext/xselinux_ext.c | 2 -- dix/extension.c | 47 ++++------------------------------------ glx/glxext.c | 4 ---- hw/dmx/glxProxy/glxext.c | 6 ----- include/extnsionst.h | 6 ----- 5 files changed, 4 insertions(+), 61 deletions(-) diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index 6325634be..1395a563b 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -714,6 +714,4 @@ SELinuxExtensionInit(void) SELinuxNumberEvents, SELinuxNumberErrors, ProcSELinuxDispatch, SProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode); - - AddExtensionAlias("Flask", extEntry); } diff --git a/dix/extension.c b/dix/extension.c index e81f673b2..b4c1c5f16 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -95,8 +95,6 @@ AddExtension(const char *name, int NumEvents, int NumErrors, return NULL; } ext->name = strdup(name); - ext->num_aliases = 0; - ext->aliases = (const char **) NULL; if (!ext->name) { dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION); free(ext); @@ -144,42 +142,15 @@ AddExtension(const char *name, int NumEvents, int NumErrors, return ext; } -Bool -AddExtensionAlias(const char *alias, ExtensionEntry * ext) -{ - char *name; - const char **aliases; - - if (!ext) - return FALSE; - aliases = reallocarray(ext->aliases, ext->num_aliases + 1, sizeof(char *)); - if (!aliases) - return FALSE; - ext->aliases = aliases; - name = strdup(alias); - if (!name) - return FALSE; - ext->aliases[ext->num_aliases] = name; - ext->num_aliases++; - return TRUE; -} - static int FindExtension(const char *extname, int len) { - int i, j; + int i; for (i = 0; i < NumExtensions; i++) { if ((strlen(extensions[i]->name) == len) && !strncmp(extname, extensions[i]->name, len)) break; - for (j = extensions[i]->num_aliases; --j >= 0;) { - if ((strlen(extensions[i]->aliases[j]) == len) && - !strncmp(extname, extensions[i]->aliases[j], len)) - break; - } - if (j >= 0) - break; } return ((i == NumExtensions) ? -1 : i); } @@ -223,16 +194,13 @@ StandardMinorOpcode(ClientPtr client) void CloseDownExtensions(void) { - int i, j; + int i; for (i = NumExtensions - 1; i >= 0; i--) { if (extensions[i]->CloseDown) extensions[i]->CloseDown(extensions[i]); NumExtensions = i; free((void *) extensions[i]->name); - for (j = extensions[i]->num_aliases; --j >= 0;) - free((void *) extensions[i]->aliases[j]); - free(extensions[i]->aliases); dixFreePrivates(extensions[i]->devPrivates, PRIVATE_EXTENSION); free(extensions[i]); } @@ -294,7 +262,7 @@ ProcListExtensions(ClientPtr client) buffer = NULL; if (NumExtensions) { - int i, j; + int i; for (i = 0; i < NumExtensions; i++) { /* call callbacks to find out whether to show extension */ @@ -302,9 +270,7 @@ ProcListExtensions(ClientPtr client) continue; total_length += strlen(extensions[i]->name) + 1; - reply.nExtensions += 1 + extensions[i]->num_aliases; - for (j = extensions[i]->num_aliases; --j >= 0;) - total_length += strlen(extensions[i]->aliases[j]) + 1; + reply.nExtensions += 1; } reply.length = bytes_to_int32(total_length); buffer = bufptr = malloc(total_length); @@ -319,11 +285,6 @@ ProcListExtensions(ClientPtr client) *bufptr++ = len = strlen(extensions[i]->name); memmove(bufptr, extensions[i]->name, len); bufptr += len; - for (j = extensions[i]->num_aliases; --j >= 0;) { - *bufptr++ = len = strlen(extensions[i]->aliases[j]); - memmove(bufptr, extensions[i]->aliases[j], len); - bufptr += len; - } } } WriteReplyToClient(client, sizeof(xListExtensionsReply), &reply); diff --git a/glx/glxext.c b/glx/glxext.c index b9b82ebeb..091dd75c1 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -424,10 +424,6 @@ GlxExtensionInit(void) FatalError("__glXExtensionInit: AddExtensions failed\n"); return; } - if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) { - ErrorF("__glXExtensionInit: AddExtensionAlias failed\n"); - return; - } __glXErrorBase = extEntry->errorBase; __glXEventBase = extEntry->eventBase; diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c index c85827284..ca9780f99 100644 --- a/hw/dmx/glxProxy/glxext.c +++ b/hw/dmx/glxProxy/glxext.c @@ -323,12 +323,6 @@ GlxExtensionInit(void) FatalError("__glXExtensionInit: AddExtensions failed\n"); return; } - /* - if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) { - ErrorF("__glXExtensionInit: AddExtensionAlias failed\n"); - return; - } - */ __glXerrorBase = extEntry->errorBase; __glXBadContext = extEntry->errorBase + GLXBadContext; diff --git a/include/extnsionst.h b/include/extnsionst.h index 8cbf333f9..80c542339 100644 --- a/include/extnsionst.h +++ b/include/extnsionst.h @@ -64,8 +64,6 @@ typedef struct _ExtensionEntry { int eventLast; int errorBase; int errorLast; - int num_aliases; - const char **aliases; void *extPrivate; unsigned short (*MinorOpcode) ( /* called for errors */ ClientPtr /* client */ ); @@ -95,10 +93,6 @@ AddExtension(const char * /*name */ , unsigned short (* /*MinorOpcodeProc */ )(ClientPtr /*client */ ) ); -extern _X_EXPORT Bool -AddExtensionAlias(const char * /*alias */ , - ExtensionEntry * /*extension */ ); - extern _X_EXPORT ExtensionEntry * CheckExtension(const char *extname); extern _X_EXPORT ExtensionEntry *