Annotation of embedaddon/lighttpd/src/data_fastcgi.c, revision 1.1.1.2
1.1.1.2 ! misho 1: #include "first.h"
! 2:
1.1 misho 3: #include "array.h"
4: #include "fastcgi.h"
5:
6: #include <string.h>
7: #include <stdio.h>
8: #include <stdlib.h>
9:
10: static data_unset *data_fastcgi_copy(const data_unset *s) {
11: data_fastcgi *src = (data_fastcgi *)s;
12: data_fastcgi *ds = data_fastcgi_init();
13:
1.1.1.2 ! misho 14: buffer_copy_buffer(ds->key, src->key);
! 15: buffer_copy_buffer(ds->host, src->host);
1.1 misho 16: ds->is_index_key = src->is_index_key;
17: return (data_unset *)ds;
18: }
19:
20: static void data_fastcgi_free(data_unset *d) {
21: data_fastcgi *ds = (data_fastcgi *)d;
22:
23: buffer_free(ds->key);
24: buffer_free(ds->host);
25:
26: free(d);
27: }
28:
29: static void data_fastcgi_reset(data_unset *d) {
30: data_fastcgi *ds = (data_fastcgi *)d;
31:
32: buffer_reset(ds->key);
33: buffer_reset(ds->host);
34:
35: }
36:
37: static int data_fastcgi_insert_dup(data_unset *dst, data_unset *src) {
38: UNUSED(dst);
39:
40: src->free(src);
41:
42: return 0;
43: }
44:
45: static void data_fastcgi_print(const data_unset *d, int depth) {
46: data_fastcgi *ds = (data_fastcgi *)d;
47: UNUSED(depth);
48:
49: fprintf(stdout, "fastcgi(%s)", ds->host->ptr);
50: }
51:
52:
53: data_fastcgi *data_fastcgi_init(void) {
54: data_fastcgi *ds;
55:
56: ds = calloc(1, sizeof(*ds));
1.1.1.2 ! misho 57: force_assert(NULL != ds);
1.1 misho 58:
59: ds->key = buffer_init();
60: ds->host = buffer_init();
61: ds->port = 0;
62: ds->is_disabled = 0;
63:
64: ds->copy = data_fastcgi_copy;
65: ds->free = data_fastcgi_free;
66: ds->reset = data_fastcgi_reset;
67: ds->insert_dup = data_fastcgi_insert_dup;
68: ds->print = data_fastcgi_print;
69: ds->type = TYPE_FASTCGI;
70:
71: return ds;
72: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>