1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Update wcsspn(3) to current coding conventions.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-09-24 21:24:52 +02:00
parent 7911b5c66c
commit 9d3bf0f164

View file

@ -26,19 +26,23 @@
extern "C" size_t wcsspn(const wchar_t* str, const wchar_t* accept)
{
size_t acceptlen = 0;
while ( accept[acceptlen] ) { acceptlen++; }
size_t accept_length = 0;
while ( accept[accept_length] )
accept_length++;
for ( size_t result = 0; true; result++ )
{
wchar_t c = str[result];
if ( !c ) { return result; }
if ( !c )
return result;
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;
break;
}
if ( !matches ) { return result; }
if ( !matches )
return result;
}
}