[exim-cvs] inlining

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] inlining
Gitweb: https://git.exim.org/exim.git/commitdiff/6d5f5cafb4c507abe36434bf7695573284eb8761
Commit:     6d5f5cafb4c507abe36434bf7695573284eb8761
Parent:     9fa4d5b45f70b36a46c0d04381a5e05cb39ae3e9
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Jul 25 15:34:10 2019 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Thu Jul 25 15:34:10 2019 +0100


    inlining
---
 src/src/mytypes.h  | 12 +++++++++++-
 src/src/readconf.c |  2 +-
 src/src/store.c    | 19 ++-----------------
 src/src/store.h    |  1 -
 4 files changed, 14 insertions(+), 20 deletions(-)


diff --git a/src/src/mytypes.h b/src/src/mytypes.h
index 84baa9e..aaa6e90 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 52c6483..6ed2ea4 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 7871d0c..41ca43d 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 6464e32..52f211e 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;