X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/c988f1f4faa9f679f79beddf3c14676c5dcb8e28..a375c22c1df005c1bd710af1e540fba6e9a496d1:/src/src/store.h diff --git a/src/src/store.h b/src/src/store.h index 0788c8305..58561ac28 100644 --- a/src/src/store.h +++ b/src/src/store.h @@ -1,10 +1,9 @@ -/* $Cambridge: exim/src/src/store.h,v 1.2 2005/01/04 10:00:42 ph10 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ +/* Copyright (c) The Exim Maintainers 2020 */ /* See the file NOTICE for conditions of use and distribution. */ /* Header for Exim's memory allocation functions */ @@ -14,13 +13,26 @@ /* Define symbols for identifying the store pools. */ -enum { POOL_MAIN, POOL_PERM, POOL_SEARCH }; +#define NPOOLS 10 +enum { POOL_MAIN, + POOL_PERM, + POOL_CONFIG, + POOL_SEARCH, + POOL_MESSAGE, + + POOL_TAINT_BASE, + + POOL_TAINT_MAIN = POOL_TAINT_BASE, + POOL_TAINT_PERM, + POOL_TAINT_CONFIG, + POOL_TAINT_SEARCH, + POOL_TAINT_MESSAGE }; /* This variable (the one for the current pool) is set by store_get() to its yield, and by store_reset() to NULL. This allows string_cat() to optimize its store handling. */ -extern void *store_last_get[3]; +extern void *store_last_get[NPOOLS]; /* This variable contains the current store pool number. */ @@ -29,26 +41,35 @@ extern int store_pool; /* Macros for calling the memory allocation routines with tracing information for debugging. */ -#define store_extend(addr,old,new) \ - store_extend_3(addr, old, new, __FILE__, __LINE__) +#define store_extend(addr, tainted, old, new) \ + store_extend_3(addr, tainted, old, new, __FUNCTION__, __LINE__) -#define store_free(addr) store_free_3(addr, __FILE__, __LINE__) -#define store_get(size) store_get_3(size, __FILE__, __LINE__) -#define store_get_perm(size) store_get_perm_3(size, __FILE__, __LINE__) -#define store_malloc(size) store_malloc_3(size, __FILE__, __LINE__) -#define store_release(addr) store_release_3(addr, __FILE__, __LINE__) -#define store_reset(addr) store_reset_3(addr, __FILE__, __LINE__) +#define store_free(addr) \ + store_free_3(addr, __FUNCTION__, __LINE__) +/* store_get & store_get_perm are in local_scan.h */ +#define store_malloc(size) \ + store_malloc_3(size, __FUNCTION__, __LINE__) +#define store_mark(void) \ + store_mark_3(__FUNCTION__, __LINE__) +#define store_newblock(addr, tainted, newsize, datalen) \ + store_newblock_3(addr, tainted, newsize, datalen, __FUNCTION__, __LINE__) +#define store_release_above(addr) \ + store_release_above_3(addr, __FUNCTION__, __LINE__) +#define store_reset(mark) \ + store_reset_3(mark, __FUNCTION__, __LINE__) /* The real functions */ - -extern BOOL store_extend_3(void *, int, int, const char *, int); /* The */ -extern void store_free_3(void *, const char *, int); /* value of the */ -extern void *store_get_3(int, const char *, int); /* 2nd arg is */ -extern void *store_get_perm_3(int, const char *, int); /* __FILE__ in */ -extern void *store_malloc_3(int, const char *, int); /* every call, */ -extern void store_release_3(void *, const char *, int); /* so give its */ -extern void store_reset_3(void *, const char *, int); /* correct type */ +typedef void ** rmark; + +extern BOOL store_extend_3(void *, BOOL, int, int, const char *, int); +extern void store_free_3(void *, const char *, int); +/* store_get_3 & store_get_perm_3 are in local_scan.h */ +extern void *store_malloc_3(int, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT; +extern rmark store_mark_3(const char *, int); +extern void *store_newblock_3(void *, BOOL, int, int, const char *, int); +extern void store_release_above_3(void *, const char *, int); +extern rmark store_reset_3(rmark, const char *, int); #endif /* STORE_H */