Annotation of embedaddon/lighttpd/src/data_array.c, revision 1.1
1.1 ! misho 1: #include "array.h"
! 2:
! 3: #include <string.h>
! 4: #include <stdio.h>
! 5: #include <stdlib.h>
! 6:
! 7: static data_unset *data_array_copy(const data_unset *s) {
! 8: data_array *src = (data_array *)s;
! 9: data_array *ds = data_array_init();
! 10:
! 11: buffer_copy_string_buffer(ds->key, src->key);
! 12: array_free(ds->value);
! 13: ds->value = array_init_array(src->value);
! 14: ds->is_index_key = src->is_index_key;
! 15: return (data_unset *)ds;
! 16: }
! 17:
! 18: static void data_array_free(data_unset *d) {
! 19: data_array *ds = (data_array *)d;
! 20:
! 21: buffer_free(ds->key);
! 22: array_free(ds->value);
! 23:
! 24: free(d);
! 25: }
! 26:
! 27: static void data_array_reset(data_unset *d) {
! 28: data_array *ds = (data_array *)d;
! 29:
! 30: /* reused array elements */
! 31: buffer_reset(ds->key);
! 32: array_reset(ds->value);
! 33: }
! 34:
! 35: static int data_array_insert_dup(data_unset *dst, data_unset *src) {
! 36: UNUSED(dst);
! 37:
! 38: src->free(src);
! 39:
! 40: return 0;
! 41: }
! 42:
! 43: static void data_array_print(const data_unset *d, int depth) {
! 44: data_array *ds = (data_array *)d;
! 45:
! 46: array_print(ds->value, depth);
! 47: }
! 48:
! 49: data_array *data_array_init(void) {
! 50: data_array *ds;
! 51:
! 52: ds = calloc(1, sizeof(*ds));
! 53:
! 54: ds->key = buffer_init();
! 55: ds->value = array_init();
! 56:
! 57: ds->copy = data_array_copy;
! 58: ds->free = data_array_free;
! 59: ds->reset = data_array_reset;
! 60: ds->insert_dup = data_array_insert_dup;
! 61: ds->print = data_array_print;
! 62: ds->type = TYPE_ARRAY;
! 63:
! 64: return ds;
! 65: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>