Merge branch '#58-issue' of lirent/libcdsb into develop
This commit is contained in:
commit
38bef70bc5
@ -144,7 +144,7 @@ inline size_t array_size (const vtype_array* x) { return x->size; }
|
|||||||
inline size_t dict_size (const vtype_dict* x) { return x->size; }
|
inline size_t dict_size (const vtype_dict* x) { return x->size; }
|
||||||
inline size_t dict_capacity(const vtype_dict* x) { return x->capacity; }
|
inline size_t dict_capacity(const vtype_dict* x) { return x->capacity; }
|
||||||
inline size_t string_nmemb (const vtype_string* x) { return (x->buffer) ? libcdsb_strlen(x->buffer) : 0; }
|
inline size_t string_nmemb (const vtype_string* x) { return (x->buffer) ? libcdsb_strlen(x->buffer) : 0; }
|
||||||
inline void string_free ( vtype_string* x) { libcdsb_free(x->buffer); x->buffer = 0; }
|
inline void string_free ( vtype_string* x) { if (x) { libcdsb_free(x->buffer); x->buffer = 0; } }
|
||||||
|
|
||||||
inline vtype_string string_copy(const vtype_string* s) {
|
inline vtype_string string_copy(const vtype_string* s) {
|
||||||
vtype_string x = { .buffer = libcdsb_strdup(s->buffer) };
|
vtype_string x = { .buffer = libcdsb_strdup(s->buffer) };
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "../__internal/assert.h"
|
#include "../__internal/assert.h"
|
||||||
|
|
||||||
void array_free(arr_t* x) {
|
void array_free(arr_t* x) {
|
||||||
|
if (is_null(x)) return;
|
||||||
|
|
||||||
if (x->size && x->type >= VTYPE_STRING) {
|
if (x->size && x->type >= VTYPE_STRING) {
|
||||||
void* p = x->mem;
|
void* p = x->mem;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "include.h"
|
#include "include.h"
|
||||||
|
|
||||||
void dict_free(dict_t* x) {
|
void dict_free(dict_t* x) {
|
||||||
|
if (is_null(x)) return;
|
||||||
|
|
||||||
while (x->capacity--) {
|
while (x->capacity--) {
|
||||||
while (!is_null(x->nodes[x->capacity])) {
|
while (!is_null(x->nodes[x->capacity])) {
|
||||||
|
@ -7,6 +7,8 @@ void list_free(list_t* x) {
|
|||||||
lnode_t* c;
|
lnode_t* c;
|
||||||
lnode_t* next;
|
lnode_t* next;
|
||||||
|
|
||||||
|
if (is_null(x)) return;
|
||||||
|
|
||||||
c = x->first;
|
c = x->first;
|
||||||
|
|
||||||
while (!is_null(c)) {
|
while (!is_null(c)) {
|
||||||
|
@ -12,6 +12,8 @@ void map_init(map_t* x, vtype t) {
|
|||||||
void map_free(map_t* x) {
|
void map_free(map_t* x) {
|
||||||
mnode_t *t, *c;
|
mnode_t *t, *c;
|
||||||
|
|
||||||
|
if (is_null(x)) return;
|
||||||
|
|
||||||
c = x->root;
|
c = x->root;
|
||||||
|
|
||||||
while (!mnode_is_empty(x->root)) {
|
while (!mnode_is_empty(x->root)) {
|
||||||
|
@ -12,6 +12,8 @@ void vset_init(set_t* x, vtype t) {
|
|||||||
void vset_free(set_t* x) {
|
void vset_free(set_t* x) {
|
||||||
rbnode_t *t, *c;
|
rbnode_t *t, *c;
|
||||||
|
|
||||||
|
if (is_null(x)) return;
|
||||||
|
|
||||||
c = x->root;
|
c = x->root;
|
||||||
|
|
||||||
while (!rbnode_is_empty(x->root)) {
|
while (!rbnode_is_empty(x->root)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user