1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2009 */
6 /* Copyright (c) The Exim Maintainers 2020 */
7 /* See the file NOTICE for conditions of use and distribution. */
9 /* Header for Exim's memory allocation functions */
14 /* Define symbols for identifying the store pools. */
25 POOL_TAINT_MAIN = POOL_TAINT_BASE,
31 /* This variable (the one for the current pool) is set by store_get() to its
32 yield, and by store_reset() to NULL. This allows string_cat() to optimize its
35 extern void *store_last_get[NPOOLS];
37 /* This variable contains the current store pool number. */
39 extern int store_pool;
41 /* Macros for calling the memory allocation routines with
42 tracing information for debugging. */
44 #define store_extend(addr, tainted, old, new) \
45 store_extend_3(addr, tainted, old, new, __FUNCTION__, __LINE__)
47 #define store_free(addr) \
48 store_free_3(addr, __FUNCTION__, __LINE__)
49 /* store_get & store_get_perm are in local_scan.h */
50 #define store_malloc(size) \
51 store_malloc_3(size, __FUNCTION__, __LINE__)
52 #define store_mark(void) \
53 store_mark_3(__FUNCTION__, __LINE__)
54 #define store_newblock(addr, tainted, newsize, datalen) \
55 store_newblock_3(addr, tainted, newsize, datalen, __FUNCTION__, __LINE__)
56 #define store_release_above(addr) \
57 store_release_above_3(addr, __FUNCTION__, __LINE__)
58 #define store_reset(mark) \
59 store_reset_3(mark, __FUNCTION__, __LINE__)
62 /* The real functions */
63 typedef void ** rmark;
65 extern BOOL store_extend_3(void *, BOOL, int, int, const char *, int);
66 extern void store_free_3(void *, const char *, int);
67 /* store_get_3 & store_get_perm_3 are in local_scan.h */
68 extern void *store_malloc_3(int, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
69 extern rmark store_mark_3(const char *, int);
70 extern void *store_newblock_3(void *, BOOL, int, int, const char *, int);
71 extern void store_release_above_3(void *, const char *, int);
72 extern rmark store_reset_3(rmark, const char *, int);