From 4577dcd5f90ae4e4e19a5ebdcec0f6f847977edf Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 31 Jan 2021 00:51:16 -0800 Subject: common: common_funcs: Add R_UNLESS_NOLOG for scenarios that should not log. --- src/common/common_funcs.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 71b64e32a..cd3207a03 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -104,6 +104,14 @@ __declspec(dllimport) void __stdcall DebugBreak(void); } \ } +/// Evaluates a boolean expression, and returns a result unless that expression is true. +#define R_UNLESS_NOLOG(expr, res) \ + { \ + if (!(expr)) { \ + return res; \ + } \ + } + #define R_SUCCEEDED(res) (res.IsSuccess()) /// Evaluates an expression that returns a result, and returns the result if it would fail. -- cgit v1.2.3