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:
parent
02a711befb
commit
2206412e14
4 changed files with 7 additions and 7 deletions
|
@ -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; }
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in a new issue