From 543eb9d217fcc4ed09b275fcaa8df11539bb3167 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 19 Jan 2008 20:02:40 -0800 Subject: Don't use a multiple lists for extensions --- Alc/ALc.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index 83ff7ba4..bca519e2 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "alMain.h" #include "alSource.h" #include "AL/al.h" @@ -78,26 +79,12 @@ struct { /////////////////////////////////////////////////////// // STRING and EXTENSIONS -typedef struct ALCextension_struct -{ - ALCchar *extName; - ALvoid *address; -} ALCextension; - typedef struct ALCfunction_struct { ALCchar *funcName; ALvoid *address; } ALCfunction; -static ALCextension alcExtensions[] = { - { "ALC_ENUMERATE_ALL_EXT", (ALvoid *) NULL }, - { "ALC_ENUMERATION_EXT", (ALvoid *) NULL }, - { "ALC_EXT_CAPTURE", (ALvoid *) NULL }, - { "ALC_EXT_EFX", (ALvoid *) NULL }, - { NULL, (ALvoid *) NULL } -}; - static ALCfunction alcFunctions[] = { { "alcCreateContext", (ALvoid *) alcCreateContext }, { "alcMakeContextCurrent", (ALvoid *) alcMakeContextCurrent }, @@ -835,18 +822,31 @@ ALCAPI ALCvoid ALCAPIENTRY alcGetIntegerv(ALCdevice *device,ALCenum param,ALsize ALCAPI ALCboolean ALCAPIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extName) { ALCboolean bResult = ALC_FALSE; - ALsizei i = 0; (void)device; if (extName) { - while(alcExtensions[i].extName && - strcasecmp(alcExtensions[i].extName,extName) != 0) - i++; + const char *ptr; + size_t len; - if (alcExtensions[i].extName) - bResult = ALC_TRUE; + len = strlen(extName); + ptr = alcExtensionList; + while(ptr && *ptr) + { + if(strncasecmp(ptr, extName, len) == 0 && + (ptr[len] == '\0' || isspace(ptr[len]))) + { + bResult = ALC_TRUE; + break; + } + if((ptr=strchr(ptr, ' ')) != NULL) + { + do { + ++ptr; + } while(isspace(*ptr)); + } + } } else SetALCError(ALC_INVALID_VALUE); -- cgit v1.2.3