mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-09 18:45:35 +00:00
SDL_InternalGlobDirectory(): keep track of pathlen and reuse it, instead of calling SDL_strlen(path)
This commit is contained in:
committed by
Ryan C. Gordon
parent
961a04fa26
commit
93e3e8a5fe
@@ -382,6 +382,7 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob
|
||||
char *ptr = &pathcpy[pathlen-1];
|
||||
while ((ptr > pathcpy) && ((*ptr == '/') || (*ptr == '\\'))) {
|
||||
*(ptr--) = '\0';
|
||||
--pathlen;
|
||||
}
|
||||
path = pathcpy;
|
||||
}
|
||||
@@ -425,7 +426,7 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob
|
||||
data.enumerator = enumerator;
|
||||
data.getpathinfo = getpathinfo;
|
||||
data.fsuserdata = userdata;
|
||||
data.basedirlen = *path ? (SDL_strlen(path) + 1) : 0; // +1 for the '/' we'll be adding.
|
||||
data.basedirlen = *path ? (pathlen + 1) : 0; // +1 for the '/' we'll be adding.
|
||||
|
||||
|
||||
char **result = NULL;
|
||||
|
||||
Reference in New Issue
Block a user