diff options
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c index 28b007b..29cc07b 100644 --- a/src/common.c +++ b/src/common.c @@ -1311,6 +1311,45 @@ color_index_t Com_ParseColor( const char *s, color_index_t last ) { return COLOR_NONE; } +#if USE_REF == REF_GL +/* +================ +Com_ParseExtensionString + +Helper function to parse an OpenGL-style extension string. +================ +*/ +unsigned Com_ParseExtensionString( const char *s, const char *const extnames[] ) { + unsigned mask; + const char *p; + size_t l1, l2; + int i; + + if( !s ) { + return 0; + } + + mask = 0; + while( *s ) { + p = Q_strchrnul( s, ' ' ); + l1 = p - s; + for( i = 0; extnames[i]; i++ ) { + l2 = strlen( extnames[i] ); + if( l1 == l2 && !memcmp( s, extnames[i], l1 ) ) { + mask |= 1 << i; + break; + } + } + if( !*p ) { + break; + } + s = p + 1; + } + + return mask; +} +#endif + /* ================ Com_PlayerToEntityState |