|
|
| version 1.1.1.1, 2013/10/14 10:32:47 | version 1.1.1.2, 2016/11/02 10:35:00 |
|---|---|
| Line 1 | Line 1 |
| #include "first.h" | |
| #include "array.h" | #include "array.h" |
| #include <string.h> | #include <string.h> |
| Line 8 static data_unset *data_config_copy(const data_unset * | Line 10 static data_unset *data_config_copy(const data_unset * |
| data_config *src = (data_config *)s; | data_config *src = (data_config *)s; |
| data_config *ds = data_config_init(); | data_config *ds = data_config_init(); |
| buffer_copy_string_buffer(ds->key, src->key); | buffer_copy_buffer(ds->key, src->key); |
| buffer_copy_string_buffer(ds->comp_key, src->comp_key); | buffer_copy_buffer(ds->comp_key, src->comp_key); |
| array_free(ds->value); | array_free(ds->value); |
| ds->value = array_init_array(src->value); | ds->value = array_init_array(src->value); |
| return (data_unset *)ds; | return (data_unset *)ds; |
| Line 23 static void data_config_free(data_unset *d) { | Line 25 static void data_config_free(data_unset *d) { |
| buffer_free(ds->comp_key); | buffer_free(ds->comp_key); |
| array_free(ds->value); | array_free(ds->value); |
| array_free(ds->childs); | vector_config_weak_clear(&ds->children); |
| if (ds->string) buffer_free(ds->string); | if (ds->string) buffer_free(ds->string); |
| #ifdef HAVE_PCRE_H | #ifdef HAVE_PCRE_H |
| Line 84 static void data_config_print(const data_unset *d, int | Line 86 static void data_config_print(const data_unset *d, int |
| fprintf(stdout, "\n"); | fprintf(stdout, "\n"); |
| } | } |
| if (ds->childs) { | fprintf(stdout, "\n"); |
| fprintf(stdout, "\n"); | for (i = 0; i < ds->children.used; i ++) { |
| for (i = 0; i < ds->childs->used; i ++) { | data_config *dc = ds->children.data[i]; |
| data_unset *du = ds->childs->data[i]; | |
| /* only the 1st block of chaining */ | /* only the 1st block of chaining */ |
| if (NULL == ((data_config *)du)->prev) { | if (NULL == dc->prev) { |
| fprintf(stdout, "\n"); | fprintf(stdout, "\n"); |
| array_print_indent(depth); | array_print_indent(depth); |
| du->print(du, depth); | dc->print((data_unset *) dc, depth); |
| fprintf(stdout, "\n"); | fprintf(stdout, "\n"); |
| } | |
| } | } |
| } | } |
| Line 124 data_config *data_config_init(void) { | Line 124 data_config *data_config_init(void) { |
| ds->op = buffer_init(); | ds->op = buffer_init(); |
| ds->comp_key = buffer_init(); | ds->comp_key = buffer_init(); |
| ds->value = array_init(); | ds->value = array_init(); |
| ds->childs = array_init(); | vector_config_weak_init(&ds->children); |
| ds->childs->is_weakref = 1; | |
| ds->copy = data_config_copy; | ds->copy = data_config_copy; |
| ds->free = data_config_free; | ds->free = data_config_free; |