Copyright updates:
[exim.git] / src / src / store.h
CommitLineData
059ec3d9
PH
1/*************************************************
2* Exim - an Internet mail transport agent *
3*************************************************/
4
0a49a7a4 5/* Copyright (c) University of Cambridge 1995 - 2009 */
1e1ddfac 6/* Copyright (c) The Exim Maintainers 2020 */
059ec3d9
PH
7/* See the file NOTICE for conditions of use and distribution. */
8
9/* Header for Exim's memory allocation functions */
10
11#ifndef STORE_H
12#define STORE_H
13
14/* Define symbols for identifying the store pools. */
15
f3ebb786
JH
16enum { POOL_MAIN, POOL_PERM, POOL_SEARCH,
17 POOL_TAINT_BASE,
18 POOL_TAINT_MAIN = POOL_TAINT_BASE, POOL_TAINT_PERM, POOL_TAINT_SEARCH };
059ec3d9
PH
19
20/* This variable (the one for the current pool) is set by store_get() to its
21yield, and by store_reset() to NULL. This allows string_cat() to optimize its
22store handling. */
23
f3ebb786 24extern void *store_last_get[6];
059ec3d9
PH
25
26/* This variable contains the current store pool number. */
27
28extern int store_pool;
29
30/* Macros for calling the memory allocation routines with
31tracing information for debugging. */
32
f3ebb786
JH
33#define store_extend(addr, tainted, old, new) \
34 store_extend_3(addr, tainted, old, new, __FUNCTION__, __LINE__)
35
36#define store_free(addr) \
37 store_free_3(addr, __FUNCTION__, __LINE__)
4ec0fcb6 38/* store_get & store_get_perm are in local_scan.h */
f3ebb786
JH
39#define store_malloc(size) \
40 store_malloc_3(size, __FUNCTION__, __LINE__)
41#define store_mark(void) \
42 store_mark_3(__FUNCTION__, __LINE__)
43#define store_newblock(addr, tainted, newsize, datalen) \
44 store_newblock_3(addr, tainted, newsize, datalen, __FUNCTION__, __LINE__)
45#define store_release_above(addr) \
46 store_release_above_3(addr, __FUNCTION__, __LINE__)
47#define store_reset(mark) \
48 store_reset_3(mark, store_pool, __FUNCTION__, __LINE__)
059ec3d9
PH
49
50
51/* The real functions */
f3ebb786 52typedef void ** rmark;
059ec3d9 53
f3ebb786 54extern BOOL store_extend_3(void *, BOOL, int, int, const char *, int);
459fca58 55extern void store_free_3(void *, const char *, int);
4ec0fcb6 56/* store_get_3 & store_get_perm_3 are in local_scan.h */
f3ebb786
JH
57extern void *store_malloc_3(int, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
58extern rmark store_mark_3(const char *, int);
59extern void *store_newblock_3(void *, BOOL, int, int, const char *, int);
60extern void store_release_above_3(void *, const char *, int);
61extern rmark store_reset_3(rmark, int, const char *, int);
059ec3d9
PH
62
63#endif /* STORE_H */
64
65/* End of store.h */