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