diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-30 09:46:33 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-30 09:46:33 -0800 |
commit | 8e4e30d266dd662b7603bbbf7be175ef49848367 (patch) | |
tree | fd3cd7562275d9a41492d1e9199eb27c8b41a5fd /common.cpp | |
parent | f988dcd6f99dc2a38917ad7c0a0630e0e4de2e2d (diff) |
Migrate functions like parser_keywords_is_block to wcstring
Diffstat (limited to 'common.cpp')
-rw-r--r-- | common.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -607,16 +607,16 @@ const wchar_t *wsetlocale(int category, const wchar_t *locale) return (wchar_t *)setlocale_buff->buff; } -int contains_internal( const wchar_t *a, ... ) +bool contains_internal( const wchar_t *a, ... ) { - wchar_t *arg; + const wchar_t *arg; va_list va; int res = 0; CHECK( a, 0 ); va_start( va, a ); - while( (arg=va_arg(va, wchar_t *) )!= 0 ) + while( (arg=va_arg(va, const wchar_t *) )!= 0 ) { if( wcscmp( a,arg) == 0 ) { @@ -626,7 +626,28 @@ int contains_internal( const wchar_t *a, ... ) } va_end( va ); - return res; + return res; +} + +/* wcstring variant of contains_internal. The first parameter is a wcstring, the rest are const wchar_t* */ +__sentinel bool contains_internal( const wcstring &needle, ... ) +{ + const wchar_t *arg; + va_list va; + int res = 0; + + va_start( va, needle ); + while( (arg=va_arg(va, const wchar_t *) )!= 0 ) + { + if( needle == arg) + { + res=1; + break; + } + + } + va_end( va ); + return res; } int read_blocked(int fd, void *buf, size_t count) |