db_gen.c 1.6 KB

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