aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-30 09:46:33 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-30 09:46:33 -0800
commit8e4e30d266dd662b7603bbbf7be175ef49848367 (patch)
treefd3cd7562275d9a41492d1e9199eb27c8b41a5fd /common.cpp
parentf988dcd6f99dc2a38917ad7c0a0630e0e4de2e2d (diff)
Migrate functions like parser_keywords_is_block to wcstring
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/common.cpp b/common.cpp
index 17e7348b..424e97dd 100644
--- a/common.cpp
+++ b/common.cpp
@@ -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)