summaryrefslogtreecommitdiffstats
path: root/server/array.h
blob: d29390e043de2b0a4d7f262ad77556cf9cc98d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef ARRAY_H
#define ARRAY_H

#include <stdarg.h>

#define ARRTERM -1

struct _string_t {
	char *str;
	int strlen;
};
typedef struct _string_t string_t;

struct _array_t {
	int nitems;
	string_t **items;
};
typedef struct _array_t array_t;

string_t *string_new(int slen, char *strdata);
void string_delete(string_t *string);

array_t *array_new();
void array_delete(array_t *array);
int va_array_add(array_t *aa, va_list ap);
int array_add(array_t *aa, ...);
int array_dup(array_t *dst, array_t *src);

#endif