diff options
author | Andrey Nazarov <skuller@skuller.net> | 2010-10-09 17:37:46 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2010-10-09 17:37:46 +0400 |
commit | d66fa13fe464e3504cd488a3884b9410623deeba (patch) | |
tree | 7ac4bb67319dbe85f7b8e5b395d44d8ea338fe04 /src/files.c | |
parent | 1f476c8de03427883ab76c504d4949dc4fa894c7 (diff) |
Avoid recursion in wildcard comparsion code.
Diffstat (limited to 'src/files.c')
-rw-r--r-- | src/files.c | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/src/files.c b/src/files.c index ab1852b..336ee7e 100644 --- a/src/files.c +++ b/src/files.c @@ -2118,52 +2118,9 @@ void **FS_CopyList( void **list, int count ) { return out; } -#if 0 -// foo*bar -// foobar -// fooblahbar -static qboolean FS_WildCmp_r( const char *filter, const char *string ) { - while( *filter && *filter != ';' ) { - if( *filter == '*' ) { - return FS_WildCmp_r( filter + 1, string ) || - ( *string && FS_WildCmp_r( filter, string + 1 ) ); - } - if( *filter == '[' ) { - filter++; - - continue; - } - if( *filter != '?' && Q_toupper( *filter ) != Q_toupper( *string ) ) { - return qfalse; - } - filter++; - string++; - } - - return !*string; -} -#endif - -static int FS_WildCmp_r( const char *filter, const char *string ) { - switch( *filter ) { - case '\0': - case ';': - return !*string; - - case '*': - return FS_WildCmp_r( filter + 1, string ) || (*string && FS_WildCmp_r( filter, string + 1 )); - - case '?': - return *string && FS_WildCmp_r( filter + 1, string + 1 ); - - default: - return ((*filter == *string) || (Q_toupper( *filter ) == Q_toupper( *string ))) && FS_WildCmp_r( filter + 1, string + 1 ); - } -} - qboolean FS_WildCmp( const char *filter, const char *string ) { do { - if( FS_WildCmp_r( filter, string ) ) { + if( Com_WildCmpEx( filter, string, ';', qtrue ) ) { return qtrue; } filter = strchr( filter, ';' ); |