summaryrefslogtreecommitdiff
path: root/table.c
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2023-09-02 21:17:20 -0400
committerTest_User <hax@andrewyu.org>2023-09-02 21:17:20 -0400
commit9a1fdcc9d24fe8dd20cacee0e25a57c6219651a2 (patch)
tree3958a711dcb053d034bd4284ce63c91e884799f0 /table.c
parente5a21f16ce6544f5291af4e5413388b9a576d68f (diff)
downloadcoupserv-9a1fdcc9d24fe8dd20cacee0e25a57c6219651a2.tar.gz
coupserv-9a1fdcc9d24fe8dd20cacee0e25a57c6219651a2.zip
clear command, some other old stufff I forgot to commit
Diffstat (limited to 'table.c')
-rw-r--r--table.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/table.c b/table.c
index a06e034..a4adf61 100644
--- a/table.c
+++ b/table.c
@@ -171,3 +171,11 @@ void * remove_table_index(struct table *tbl, struct string name) {
return ptr;
}
+
+void clear_table(struct table *tbl) {
+ for (uint64_t i = 0; i < tbl->len; i++)
+ free(tbl->array[i].name.data);
+
+ tbl->array = realloc(tbl->array, 0);
+ tbl->len = 0;
+}