1 /* EINA - EFL data type library
2 * Copyright (C) 2007-2008 Jorge Luis Zapata Muga
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
19 #ifndef EINA_LALLOC_H_
20 #define EINA_LALLOC_H_
22 #include "eina_types.h"
25 * @addtogroup Eina_Tools_Group Tools
31 * @defgroup Eina_Lalloc_Group Lazy allocator
36 typedef Eina_Bool (*Eina_Lalloc_Alloc)(void *user_data, int num);
38 * @def EINA_LALLOC_ALLOC
39 * @param function The function to allocate.
41 #define EINA_LALLOC_ALLOC(function) ((Eina_Lalloc_Alloc)function)
42 typedef void (*Eina_Lalloc_Free)(void *user_data);
44 * @def EINA_LALLOC_FREE
45 * @param function The function to free.
47 #define EINA_LALLOC_FREE(function) ((Eina_Lalloc_Free)function)
49 typedef struct _Eina_Lalloc Eina_Lalloc;
51 EAPI Eina_Lalloc *eina_lalloc_new(void *data,
52 Eina_Lalloc_Alloc alloc_cb,
53 Eina_Lalloc_Free free_cb,
54 int num_init) EINA_ARG_NONNULL(2, 3);
55 EAPI void eina_lalloc_free(Eina_Lalloc *a) EINA_ARG_NONNULL(1);
56 EAPI Eina_Bool eina_lalloc_elements_add(Eina_Lalloc *a,
57 int num) EINA_ARG_NONNULL(1);
58 EAPI Eina_Bool eina_lalloc_element_add(Eina_Lalloc *a) EINA_ARG_NONNULL(1);
68 #endif /* EINA_LALLOC_H_ */