From: Steffan Karger Date: Thu, 1 Sep 2016 19:13:27 +0000 (+0200) Subject: cleanup: remove code duplication in msg_test() X-Git-Tag: contains~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59114b956a46c89da06b36a37b4db0a7a087b879;p=thirdparty%2Fopenvpn.git cleanup: remove code duplication in msg_test() Use check_debug_level() instead of writing out the exact same check in msg_test(). Signed-off-by: Steffan Karger Acked-by: David Sommerseth Message-Id: 1472757207-17900-1-git-send-email-steffan@karger.me URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00192.html Signed-off-by: David Sommerseth (cherry picked from commit d7ce876841d1d5b01940251f92780fdbb05b4df0) --- diff --git a/src/openvpn/error.h b/src/openvpn/error.h index 4024e5e50..36819e0a8 100644 --- a/src/openvpn/error.h +++ b/src/openvpn/error.h @@ -138,12 +138,6 @@ extern int x_msg_line_num; /** Check muting filter */ bool dont_mute (unsigned int flags); -/** Return true if flags represent an enabled, not muted log level */ -static inline bool msg_test (unsigned int flags) -{ - return ((flags & M_DEBUG_LEVEL) <= x_debug_level) && dont_mute (flags); -} - /* Macro to ensure (and teach static analysis tools) we exit on fatal errors */ #define EXIT_FATAL(flags) do { if ((flags) & M_FATAL) _exit(1); } while (false) @@ -235,6 +229,12 @@ check_debug_level (unsigned int level) return (level & M_DEBUG_LEVEL) <= x_debug_level; } +/** Return true if flags represent an enabled, not muted log level */ +static inline bool msg_test (unsigned int flags) +{ + return check_debug_level (flags) && dont_mute (flags); +} + /* Call if we forked */ void msg_forked (void);