From: Jeremy Harris Date: Thu, 25 Jul 2019 14:34:10 +0000 (+0100) Subject: inlining X-Git-Tag: exim-4.93-RC0~128 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/6d5f5cafb4c507abe36434bf7695573284eb8761 inlining --- diff --git a/src/src/mytypes.h b/src/src/mytypes.h index 84baa9eea..aaa6e9052 100644 --- a/src/src/mytypes.h +++ b/src/src/mytypes.h @@ -125,9 +125,19 @@ functions that are called quite often; for other calls to external libraries #define Ustrtoul(s,t,b) strtoul(CCS(s),CSS(t),b) #define Uunlink(s) unlink(CCS(s)) -extern BOOL is_tainted(const void *); extern void die_tainted(const uschar *, const uschar *, int); +/* Predicate: if an address is in a tainted pool. +By extension, a variable pointing to this address is tainted. +*/ + +static inline BOOL +is_tainted(const void * p) +{ +extern void * tainted_base, * tainted_top; +return p >= tainted_base && p < tainted_top; +} + static inline uschar * __Ustrcat(uschar * dst, const uschar * src, const char * func, int line) { #ifndef COMPILE_UTILITY diff --git a/src/src/readconf.c b/src/src/readconf.c index 52c64830e..6ed2ea409 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -3337,7 +3337,7 @@ syscalls). It also assume we're on the relevant pool. */ if (statbuf.st_size > 8192) { rmark r = store_mark(); - store_get((int)statbuf.st_size, FALSE); + void * dummy = store_get((int)statbuf.st_size, FALSE); store_reset(r); } diff --git a/src/src/store.c b/src/src/store.c index 7871d0ccc..41ca43d65 100644 --- a/src/src/store.c +++ b/src/src/store.c @@ -106,8 +106,8 @@ static int yield_length[NPOOLS] = { -1, -1, -1, -1, -1, -1 }; a fast is_tainted implementation. We assume the kernel only allocates mmaps using one side or the other of data+heap, not both. */ -static void * tainted_base = (void *)-1; -static void * tainted_top = (void *)0; +void * tainted_base = (void *)-1; +void * tainted_top = (void *)0; /* pool_malloc holds the amount of memory used by the store pools; this goes up and down as store is reset or released. nonpool_malloc is the total got by @@ -159,21 +159,6 @@ static void internal_store_free(void *, const char *, int linenumber); /******************************************************************************/ -/* Predicate: if an address is in a tainted pool. -By extension, a variable pointing to this address is tainted. -*/ - -BOOL -is_tainted(const void * p) -{ -BOOL rc = p >= tainted_base && p < tainted_top; - -#ifndef COMPILE_UTILITY -DEBUG(D_memory) if (rc) debug_printf_indent("is_tainted: YES\n"); -#endif -return rc; -} - void die_tainted(const uschar * msg, const uschar * func, int line) { diff --git a/src/src/store.h b/src/src/store.h index 6464e32ed..52f211ef5 100644 --- a/src/src/store.h +++ b/src/src/store.h @@ -53,7 +53,6 @@ tracing information for debugging. */ /* The real functions */ typedef void ** rmark; -extern BOOL is_tainted(const void *); extern BOOL store_extend_3(void *, BOOL, int, int, const char *, int); extern void store_free_3(void *, const char *, int); extern void *store_get_3(int, BOOL, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;