diff --git a/src/util-debug.h b/src/util-debug.h index b3fdd50161..8b352f9535 100644 --- a/src/util-debug.h +++ b/src/util-debug.h @@ -352,6 +352,8 @@ extern int sc_log_module_cleaned; #define SCReturnPtr(x, type) return x +#define SCReturnBool(x) return x + /* Please use it only for debugging purposes */ #else @@ -534,6 +536,24 @@ extern int sc_log_module_cleaned; return x; \ } while(0) +/** + * \brief Macro used to log debug messages on function exit. Comes under the + * debugging sybsystem, and hence will be enabled only in the presence + * of the DEBUG macro. Apart from logging function_exit logs, it also + * processes the FD filters, if any FD filters are registered. This + * function_exit macro should be used for functions that returns a + * boolean value. + * + * \retval x Variable of type 'bool' that has to be returned + */ +#define SCReturnBool(x) do { \ + if (sc_log_global_log_level >= SC_LOG_DEBUG) { \ + SCLogDebug("Returning: %s ... <<", x ? "true" : "false"); \ + SCLogCheckFDFilterExit(__FUNCTION__); \ + } \ + return x; \ + } while(0) + #endif /* DEBUG */ #define FatalError(x, ...) do { \