Update wcsspn(3) to current coding conventions.
This commit is contained in:
parent
7911b5c66c
commit
9d3bf0f164
|
@ -26,19 +26,23 @@
|
||||||
|
|
||||||
extern "C" size_t wcsspn(const wchar_t* str, const wchar_t* accept)
|
extern "C" size_t wcsspn(const wchar_t* str, const wchar_t* accept)
|
||||||
{
|
{
|
||||||
size_t acceptlen = 0;
|
size_t accept_length = 0;
|
||||||
while ( accept[acceptlen] ) { acceptlen++; }
|
while ( accept[accept_length] )
|
||||||
|
accept_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 < acceptlen; i++ )
|
for ( size_t i = 0; i < accept_length; i++ )
|
||||||
{
|
{
|
||||||
if ( str[result] != accept[i] ) { continue; }
|
if ( str[result] != accept[i] )
|
||||||
|
continue;
|
||||||
matches = true;
|
matches = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( !matches ) { return result; }
|
if ( !matches )
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue