[utils] Adding cstring_array_clear method
This commit is contained in:
@@ -544,7 +544,6 @@ cstring_array *cstring_array_new(void) {
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
void cstring_array_destroy(cstring_array *self) {
|
||||
if (self == NULL) return;
|
||||
if (self->indices) {
|
||||
@@ -597,6 +596,18 @@ inline void cstring_array_resize(cstring_array *self, size_t size) {
|
||||
char_array_resize(self->str, size);
|
||||
}
|
||||
|
||||
void cstring_array_clear(cstring_array *self) {
|
||||
if (self == NULL) return;
|
||||
|
||||
if (self->indices != NULL) {
|
||||
uint32_array_clear(self->indices);
|
||||
}
|
||||
|
||||
if (self->str != NULL) {
|
||||
char_array_clear(self->str);
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32_t cstring_array_start_token(cstring_array *self) {
|
||||
uint32_t index = self->str->n;
|
||||
uint32_array_push(self->indices, index);
|
||||
|
||||
@@ -135,6 +135,7 @@ size_t cstring_array_capacity(cstring_array *self);
|
||||
size_t cstring_array_used(cstring_array *self);
|
||||
size_t cstring_array_num_strings(cstring_array *self);
|
||||
void cstring_array_resize(cstring_array *self, size_t size);
|
||||
void cstring_array_clear(cstring_array *self);
|
||||
|
||||
cstring_array *cstring_array_from_char_array(char_array *str);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user