1 /*
2 * Copyright (C) 2001-2003 FhG FOKUS
3 * Copyright (C) 2006-2007 iptelorg GmbH
4 *
5 * This file is part of Kamailio, a free SIP server.
6 *
7 * Kamailio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version
11 *
12 * Kamailio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /** \ingroup DB_API
23 * @{
24 */
25
26 #include "db_gen.h"
27 #include <string.h>
28
29 int db_payload_idx = 0;
30
31
32 /*
33 * Initialize a db_gen structure and make space for the data
34 * from n database drivers
35 */
db_gen_init(db_gen_t * gen)36 int db_gen_init(db_gen_t* gen)
37 {
38 memset(gen, '\0', sizeof(db_gen_t));
39 return 0;
40 }
41
42
43 /*
44 * Free all memory allocated by a db_gen structure
45 */
db_gen_free(db_gen_t * gen)46 void db_gen_free(db_gen_t* gen)
47 {
48 int i;
49
50 /* Dispose all the attached data structures */
51 for(i = 0; i < DB_PAYLOAD_MAX && gen->data[i]; i++) {
52 if (gen->data[i]) gen->data[i]->free(gen, gen->data[i]);
53 }
54 }
55
56 /** @} */
57