in source/aws_profile.c [126:155]
static bool s_parse_by_character_predicate(
struct aws_byte_cursor *start,
aws_byte_predicate_fn *predicate,
struct aws_byte_cursor *parsed,
size_t maximum_allowed) {
uint8_t *current_ptr = start->ptr;
uint8_t *end_ptr = start->ptr + start->len;
if (maximum_allowed > 0 && maximum_allowed < start->len) {
end_ptr = start->ptr + maximum_allowed;
}
while (current_ptr < end_ptr) {
if (!predicate(*current_ptr)) {
break;
}
++current_ptr;
}
size_t consumed = current_ptr - start->ptr;
if (parsed != NULL) {
parsed->ptr = start->ptr;
parsed->len = consumed;
}
aws_byte_cursor_advance(start, consumed);
return consumed > 0;
}