EFL 1.7 svn doobies
[profile/ivi/eina.git] / src / modules / mp / pass_through / eina_pass_through.c
1 /* EINA - EFL data type library
2  * Copyright (C) 2008 Cedric BAIL
3  *
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.
8  *
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.
13  *
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/>.
17  */
18
19 #ifdef HAVE_CONFIG_H
20 # include "config.h"
21 #endif
22
23 #include <stdlib.h>
24
25 #include "eina_types.h"
26 #include "eina_module.h"
27 #include "eina_mempool.h"
28 #include "eina_private.h"
29
30 static void *
31 eina_pass_through_malloc(__UNUSED__ void *data, unsigned int size)
32 {
33    return malloc(size);
34 }
35
36 static void
37 eina_pass_through_free(__UNUSED__ void *data, void *ptr)
38 {
39    free(ptr);
40 }
41
42 static void *
43 eina_pass_through_realloc(__UNUSED__ void *data, void *ptr, unsigned int size)
44 {
45    return realloc(ptr, size);
46 }
47
48 static void *
49 eina_pass_through_init(__UNUSED__ const char *context,
50                        __UNUSED__ const char *option,
51                        __UNUSED__ va_list args)
52 {
53    return (void *)0x1;
54 }
55
56 static void
57 eina_pass_through_shutdown(__UNUSED__ void *data)
58 {
59 }
60
61
62 static Eina_Mempool_Backend _eina_pass_through_mp_backend = {
63    "pass_through",
64    &eina_pass_through_init,
65    &eina_pass_through_free,
66    &eina_pass_through_malloc,
67    &eina_pass_through_realloc,
68    NULL,
69    NULL,
70    &eina_pass_through_shutdown,
71    NULL
72 };
73
74 Eina_Bool pass_through_init(void)
75 {
76    return eina_mempool_register(&_eina_pass_through_mp_backend);
77 }
78
79 void pass_through_shutdown(void)
80 {
81    eina_mempool_unregister(&_eina_pass_through_mp_backend);
82 }
83
84 #ifndef EINA_STATIC_BUILD_PASS_THROUGH
85
86 EINA_MODULE_INIT(pass_through_init);
87 EINA_MODULE_SHUTDOWN(pass_through_shutdown);
88
89 #endif /* ! EINA_STATIC_BUILD_PASS_THROUGH */
90