Update wcscspn(3) to current coding conventions.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-09-24 21:19:10 +02:00
parent 6b0060f2ec
commit b4c7a6aa4a
1 changed files with 10 additions and 6 deletions

View File

@ -26,19 +26,23 @@
extern "C" size_t wcscspn(const wchar_t* str, const wchar_t* reject)
{
size_t rejectlen = 0;
while ( reject[rejectlen] ) { rejectlen++; }
size_t reject_length = 0;
while ( reject[reject_length] )
reject_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 < 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;
break;
}
if ( matches ) { return result; }
if ( matches )
return result;
}
}