[utils] Adding cstring_array_clear method

This commit is contained in:
Al
2015-07-06 12:48:26 -04:00
parent 0df816fd31
commit d7f73e62f1
2 changed files with 13 additions and 1 deletions

View File

@@ -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);