mempool-system.c revision 333e77916f5c17eac34c77b54281a5e9435032c3
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen/* Copyright (c) 2002-2003 Timo Sirainen */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen/* @UNSAFE: whole file */
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenstatic const char *pool_system_get_name(pool_t pool);
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenstatic void *pool_system_malloc(pool_t pool, size_t size);
b039dabf4c53f72454e795930e7643b6e0e625f9Timo Sirainenstatic void pool_system_free(pool_t pool, void *mem);
b039dabf4c53f72454e795930e7643b6e0e625f9Timo Sirainenstatic void *pool_system_realloc(pool_t pool, void *mem,
b039dabf4c53f72454e795930e7643b6e0e625f9Timo Sirainenstatic size_t pool_system_get_max_easy_alloc_size(pool_t pool);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstatic const char *pool_system_get_name(pool_t pool __attr_unused__)
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainen return "system";
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstatic void pool_system_ref(pool_t pool __attr_unused__)
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainenstatic void pool_system_unref(pool_t *pool __attr_unused__)
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainenstatic void *pool_system_malloc(pool_t pool __attr_unused__, size_t size)
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainen i_panic("Trying to allocate %"PRIuSIZE_T" bytes", size);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen "pool_system_malloc(): Out of memory");
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstatic void pool_system_free(pool_t pool __attr_unused__,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstatic void *pool_system_realloc(pool_t pool __attr_unused__, void *mem,
4d2211dac61c615c5bdfd501ea54d46c89d41b0fTimo Sirainen i_panic("Trying to allocate %"PRIuSIZE_T" bytes", new_size);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen "pool_system_realloc(): Out of memory");
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainen /* clear new data */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen memset((char *) mem + old_size, 0, new_size - old_size);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstatic void pool_system_clear(pool_t pool __attr_unused__)
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen i_panic("pool_system_clear() must not be called");