lighttpd 1.4.x https://www.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.3 KiB

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "array.h"
static data_unset *data_array_copy(data_unset *s) {
data_array *src = (data_array *)s;
data_array *ds = data_array_init();
ds->key = buffer_init_buffer(src->key);
ds->value = array_init_array(src->value);
return (data_unset *)ds;
}
static void data_array_free(data_unset *d) {
data_array *ds = (data_array *)d;
buffer_free(ds->key);
array_free(ds->value);
free(d);
}
static void data_array_reset(data_unset *d) {
data_array *ds = (data_array *)d;
/* reused array elements */
buffer_reset(ds->key);
array_reset(ds->value);
}
static int data_array_insert_dup(data_unset *dst, data_unset *src) {
UNUSED(dst);
src->free(src);
return 0;
}
static void data_array_print(data_unset *d, int depth) {
data_array *ds = (data_array *)d;
array_print_indent(depth);
fprintf(stderr, "{%s:\n", ds->key->ptr);
array_print(ds->value, depth + 1);
array_print_indent(depth);
fprintf(stderr, "}");
}
data_array *data_array_init(void) {
data_array *ds;
ds = calloc(1, sizeof(*ds));
ds->key = buffer_init();
ds->value = array_init();
ds->copy = data_array_copy;
ds->free = data_array_free;
ds->reset = data_array_reset;
ds->insert_dup = data_array_insert_dup;
ds->print = data_array_print;
ds->type = TYPE_ARRAY;
return ds;
}