[fix] contiguous string array

This commit is contained in:
Al
2015-04-03 11:22:50 -04:00
parent fcaeebd656
commit 5f3d74de18
2 changed files with 2 additions and 1 deletions

View File

@@ -382,7 +382,6 @@ uint32_t cstring_array_add_string(cstring_array *self, char *str) {
uint32_t cstring_array_add_string_len(cstring_array *self, char *str, size_t len) {
uint32_t index = cstring_array_start_token(self);
cstring_array_start_token(self);
char_array_append_len(self->str, str, len);
char_array_terminate(self->str);
return index;
@@ -397,6 +396,7 @@ int32_t cstring_array_get_offset(cstring_array *self, uint32_t i) {
char *cstring_array_get_token(cstring_array *self, uint32_t i) {
int32_t data_index = cstring_array_get_offset(self, i);
if (data_index < 0) return NULL;
return self->str->a + data_index;
}

View File

@@ -28,6 +28,7 @@ bool string_ends_with(const char *str, const char *ending);
uint string_translate(char *str, size_t len, char *word_chars, char *word_repls, size_t trans_len);
char *utf8_reversed_string(const char *s); // returns a copy, caller frees
ssize_t utf8proc_iterate_reversed(const uint8_t *str, const uint8_t *start, int32_t *dst);
bool utf8_is_letter(int32_t ch);
char *string_strip_whitespace(char *str);