mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Slightly increase efficiency of osd_findsymbol() (this is the slow one that has to handle partial matches)
git-svn-id: https://svn.eduke32.com/eduke32@7008 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b0e0cfa2c9
commit
39c0c93615
1 changed files with 5 additions and 3 deletions
|
@ -1736,7 +1736,7 @@ static char *strtoken(char *s, char **ptrptr, int32_t *restart)
|
|||
if (!p) return NULL;
|
||||
|
||||
// eat up any leading whitespace
|
||||
while (*p != 0 && *p != ';' && *p == ' ') p++;
|
||||
while (*p && *p == ' ') p++;
|
||||
|
||||
// a semicolon is an end of statement delimiter like a \0 is, so we signal
|
||||
// the caller to 'restart' for the rest of the string pointed at by *ptrptr
|
||||
|
@ -1985,13 +1985,15 @@ static osdsymbol_t *osd_addsymbol(const char *pszName)
|
|||
//
|
||||
// findsymbol() -- Finds a symbol, possibly partially named
|
||||
//
|
||||
static osdsymbol_t * osd_findsymbol(const char *pszName, osdsymbol_t *pSymbol)
|
||||
static osdsymbol_t * osd_findsymbol(const char * const pszName, osdsymbol_t *pSymbol)
|
||||
{
|
||||
if (!pSymbol) pSymbol = symbols;
|
||||
if (!pSymbol) return NULL;
|
||||
|
||||
int const nameLen = Bstrlen(pszName);
|
||||
|
||||
for (; pSymbol; pSymbol=pSymbol->next)
|
||||
if (pSymbol->func != OSD_UNALIASED && !Bstrncasecmp(pszName, pSymbol->name, Bstrlen(pszName))) return pSymbol;
|
||||
if (pSymbol->func != OSD_UNALIASED && !Bstrncasecmp(pszName, pSymbol->name, nameLen)) return pSymbol;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue