Build: workaround inlining problems on Solaris
[exim.git] / src / src / mytypes.h
index 84baa9eea310e111c3e00135a6916d05ec7944b4..7d35fe0d83b29b9a593b67d3f684649b74bc4baa 100644 (file)
@@ -125,33 +125,47 @@ 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)
+{
+#ifdef MACRO_PREDEF
+return FALSE;
+#else
+extern void * tainted_base, * tainted_top;
+return p >= tainted_base && p < tainted_top;
+#endif
+}
+
 static inline uschar * __Ustrcat(uschar * dst, const uschar * src, const char * func, int line)
 {
-#ifndef COMPILE_UTILITY
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
 if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrcat", CUS func, line);
 #endif
 return US strcat(CS dst, CCS src);
 }
 static inline uschar * __Ustrcpy(uschar * dst, const uschar * src, const char * func, int line)
 {
-#ifndef COMPILE_UTILITY
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
 if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrcpy", CUS func, line);
 #endif
 return US strcpy(CS dst, CCS src);
 }
 static inline uschar * __Ustrncat(uschar * dst, const uschar * src, size_t n, const char * func, int line)
 {
-#ifndef COMPILE_UTILITY
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
 if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrncat", CUS func, line);
 #endif
 return US strncat(CS dst, CCS src, n);
 }
 static inline uschar * __Ustrncpy(uschar * dst, const uschar * src, size_t n, const char * func, int line)
 {
-#ifndef COMPILE_UTILITY
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
 if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrncpy", CUS func, line);
 #endif
 return US strncpy(CS dst, CCS src, n);