Inline four often-called new functions
authorPhil Pennock <phil+git@pennock-tech.com>
Mon, 2 Nov 2020 07:23:14 +0000 (02:23 -0500)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Thu, 27 May 2021 19:30:32 +0000 (21:30 +0200)
The BDAT state switchers should happen so often during SMTP reception that a
compiler hint to inline seems wise.

The length filter checks happen on every start-up, which for Exim is often
enough that I think an inline these is warranted too.

(cherry picked from commit 6e3d0e3f1c8228ef19a3d1ba61f131cef3172ceb)
(cherry picked from commit 6ca5fcba34070f4495a0188f16eb2e4d78f3430a)

src/src/exim.c
src/src/smtp_in.c

index d6f0c08f742ef44b13eff16228a51597fb6d0a14..abb3ba7c01a3c5adf11aa4179c8a2ecb10543944 100644 (file)
@@ -761,7 +761,7 @@ exit(EXIT_FAILURE);
 }
 
 /* fail if a length is too long */
 }
 
 /* fail if a length is too long */
-static void
+static inline void
 exim_len_fail_toolong(int itemlen, int maxlen, const char *description)
 {
 if (itemlen <= maxlen)
 exim_len_fail_toolong(int itemlen, int maxlen, const char *description)
 {
 if (itemlen <= maxlen)
@@ -772,7 +772,7 @@ exit(EXIT_FAILURE);
 }
 
 /* only pass through the string item back to the caller if it's short enough */
 }
 
 /* only pass through the string item back to the caller if it's short enough */
-static const uschar *
+static inline const uschar *
 exim_str_fail_toolong(const uschar *item, int maxlen, const char *description)
 {
 exim_len_fail_toolong(Ustrlen(item), maxlen, description);
 exim_str_fail_toolong(const uschar *item, int maxlen, const char *description)
 {
 exim_len_fail_toolong(Ustrlen(item), maxlen, description);
index 9ffc24618f9e64cc37864ae984e3aab54d9658e6..93d5cece38525c40dfaaf1d3e32955f1c030c658 100644 (file)
@@ -594,8 +594,8 @@ if (n > 0)
 
 
 /* Forward declarations */
 
 
 /* Forward declarations */
-static void bdat_push_receive_functions(void);
-static void bdat_pop_receive_functions(void);
+static inline void bdat_push_receive_functions(void);
+static inline void bdat_pop_receive_functions(void);
 
 
 /* Get a byte from the smtp input, in CHUNKING mode.  Handle ack of the
 
 
 /* Get a byte from the smtp input, in CHUNKING mode.  Handle ack of the
@@ -776,7 +776,7 @@ if (chunking_state != CHUNKING_LAST)
 }
 
 
 }
 
 
-static void
+static inline void
 bdat_push_receive_functions(void)
 {
 /* push the current receive_* function on the "stack", and
 bdat_push_receive_functions(void)
 {
 /* push the current receive_* function on the "stack", and
@@ -797,7 +797,7 @@ receive_getc = bdat_getc;
 receive_ungetc = bdat_ungetc;
 }
 
 receive_ungetc = bdat_ungetc;
 }
 
-static void
+static inline void
 bdat_pop_receive_functions(void)
 {
 receive_getc = lwr_receive_getc;
 bdat_pop_receive_functions(void)
 {
 receive_getc = lwr_receive_getc;