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

Replace Maxsi::String::Reject with strcspn.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-09-22 23:00:54 +02:00
parent 02a711befb
commit 2206412e14
4 changed files with 7 additions and 7 deletions

View file

@ -1088,9 +1088,9 @@ extern "C" bool ReadParamString(const char* str, ...)
va_list args;
while ( *str )
{
size_t varlen = String::Reject(str, ",");
size_t varlen = strcspn(str, ",");
if ( !varlen ) { str++; continue; }
size_t namelen = String::Reject(str, "=");
size_t namelen = strcspn(str, "=");
if ( !namelen ) { errno = EINVAL; goto cleanup; }
if ( !str[namelen] ) { errno = EINVAL; goto cleanup; }
if ( varlen < namelen ) { errno = EINVAL; goto cleanup; }

View file

@ -37,9 +37,9 @@ extern "C" bool ReadParamString(const char* str, ...)
va_list args;
while ( *str )
{
size_t varlen = String::Reject(str, ",");
size_t varlen = strcspn(str, ",");
if ( !varlen ) { str++; continue; }
size_t namelen = String::Reject(str, "=");
size_t namelen = strcspn(str, "=");
if ( !namelen ) { errno = EINVAL; goto cleanup; }
if ( !str[namelen] ) { errno = EINVAL; goto cleanup; }
if ( varlen < namelen ) { errno = EINVAL; goto cleanup; }

View file

@ -124,7 +124,7 @@ ssize_t DevLineCommand::Write(const uint8_t* src, size_t count)
if ( available < count ) { count = available; }
memcpy(cmd + sofar, src, count);
cmd[sofar += count] = 0;
size_t newlinepos = String::Reject(cmd, "\n");
size_t newlinepos = strcspn(cmd, "\n");
if ( !cmd[newlinepos] ) { return count; }
cmd[newlinepos] = 0;
if ( !handler(user, cmd) ) { return -1; }

View file

@ -42,9 +42,9 @@ bool ReadParamString(const char* str, ...)
va_list args;
while ( *str )
{
size_t varlen = String::Reject(str, ",");
size_t varlen = strcspn(str, ",");
if ( !varlen ) { str++; continue; }
size_t namelen = String::Reject(str, "=");
size_t namelen = strcspn(str, "=");
if ( !namelen ) { errno = EINVAL; goto cleanup; }
if ( !str[namelen] ) { errno = EINVAL; goto cleanup; }
if ( varlen < namelen ) { errno = EINVAL; goto cleanup; }