]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/dd.h
e072e067de25681fc653b4bef0f3749535b28701
[netatalk.git] / etc / afpd / dd.h
1 /*
2   Copyright (c) 2012 Frank Lahm <franklahm@gmail.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 */
14
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif /* HAVE_CONFIG_H */
18
19 #ifndef DD_H
20 #define DD_H
21
22 /* dynamic datastore */
23 typedef struct {
24     void **dd_talloc_array;
25 } dd_t;
26
27 #define dd_init(dd) (dd)->dd_talloc_array = NULL;
28
29 #define dd_add_obj(dd, obj, type, destructor)                              \
30     _dd_add_obj((dd), talloc((dd), type), (obj), sizeof(type), (destructor));
31
32 #define dd_get_count(dd) talloc_array_length(dd->dd_talloc_array)
33
34 extern int _dd_add_obj(dd_t *dd, void *talloc_chunk, void *obj, size_t size, int (*destructor)(void *));
35
36 #endif  /* DD_H */