ds: string: set iterator value to B_WCHAR_INVALID when end of string is reached
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* maximum length of string that can be stored inline, not including null-terminator */
|
||||
/* maximum length of string that can be stored inline, not including
|
||||
* null-terminator */
|
||||
#define STRING_INLINE_CAPACITY 15
|
||||
|
||||
#define IS_VALID_UTF8_SCALAR(x) \
|
||||
@@ -243,7 +244,8 @@ static int string_change_capacity(struct b_string_p *str, size_t capacity)
|
||||
bool is_now_inline = capacity == STRING_INLINE_CAPACITY;
|
||||
|
||||
if (capacity == old_capacity) {
|
||||
/* this also handles the case where the old and new capacity both fit into the inline buffer. */
|
||||
/* this also handles the case where the old and new capacity
|
||||
* both fit into the inline buffer. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1447,6 +1449,7 @@ static enum b_status chars_iterator_move_next(struct b_string_iterator_p *it)
|
||||
it->codepoint_index += 1;
|
||||
|
||||
if (it->byte_index >= it->_s_p->s_len) {
|
||||
it->char_value = B_WCHAR_INVALID;
|
||||
return B_ERR_NO_DATA;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user