Update container free methods (#58)

This commit is contained in:
2022-08-26 12:46:59 +03:00
parent 0881ba9076
commit 4dfe971282
6 changed files with 10 additions and 1 deletions
+2
View File
@@ -5,6 +5,8 @@
#include "../__internal/assert.h"
void array_free(arr_t* x) {
if (is_null(x)) return;
if (x->size && x->type >= VTYPE_STRING) {
void* p = x->mem;
+1
View File
@@ -4,6 +4,7 @@
#include "include.h"
void dict_free(dict_t* x) {
if (is_null(x)) return;
while (x->capacity--) {
while (!is_null(x->nodes[x->capacity])) {
+2
View File
@@ -7,6 +7,8 @@ void list_free(list_t* x) {
lnode_t* c;
lnode_t* next;
if (is_null(x)) return;
c = x->first;
while (!is_null(c)) {
+2
View File
@@ -12,6 +12,8 @@ void map_init(map_t* x, vtype t) {
void map_free(map_t* x) {
mnode_t *t, *c;
if (is_null(x)) return;
c = x->root;
while (!mnode_is_empty(x->root)) {
+2
View File
@@ -12,6 +12,8 @@ void vset_init(set_t* x, vtype t) {
void vset_free(set_t* x) {
rbnode_t *t, *c;
if (is_null(x)) return;
c = x->root;
while (!rbnode_is_empty(x->root)) {