Update wcscspn(3) to current coding conventions.
This commit is contained in:
parent
6b0060f2ec
commit
b4c7a6aa4a
|
@ -26,19 +26,23 @@
|
||||||
|
|
||||||
extern "C" size_t wcscspn(const wchar_t* str, const wchar_t* reject)
|
extern "C" size_t wcscspn(const wchar_t* str, const wchar_t* reject)
|
||||||
{
|
{
|
||||||
size_t rejectlen = 0;
|
size_t reject_length = 0;
|
||||||
while ( reject[rejectlen] ) { rejectlen++; }
|
while ( reject[reject_length] )
|
||||||
|
reject_length++;
|
||||||
for ( size_t result = 0; true; result++ )
|
for ( size_t result = 0; true; result++ )
|
||||||
{
|
{
|
||||||
wchar_t c = str[result];
|
wchar_t c = str[result];
|
||||||
if ( !c ) { return result; }
|
if ( !c )
|
||||||
|
return result;
|
||||||
bool matches = false;
|
bool matches = false;
|
||||||
for ( size_t i = 0; i < rejectlen; i++ )
|
for ( size_t i = 0; i < reject_length; i++ )
|
||||||
{
|
{
|
||||||
if ( str[result] != reject[i] ) { continue; }
|
if ( str[result] != reject[i] )
|
||||||
|
continue;
|
||||||
matches = true;
|
matches = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( matches ) { return result; }
|
if ( matches )
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue