diff --git a/Frameworks/include/wil/result.h b/Frameworks/include/wil/result.h index 5c6f2c97d3..d8f432c5a6 100644 --- a/Frameworks/include/wil/result.h +++ b/Frameworks/include/wil/result.h @@ -1144,27 +1144,16 @@ typedef _Return_type_success_(return >= 0) LONG NTSTATUS; return; \ } \ } while (0, 0) - -#define RETURN_RESULT_IF_NULL(input, result) \ - do { \ - if (!input) { \ - return result; \ - } \ +#define RETURN_RESULT_IF(condition, result) \ + do { \ + if (condition) { \ + return result; \ + } \ } while (0, 0) -#define RETURN_RESULT_IF_FAILED(input, result) \ - do { \ - if (FAILED(input)) { \ - return result; \ - } \ - } while (0, 0) -#define RETURN_RESULT_IF(input, result) \ - do { \ - if (FAILED(input)) { \ - return result; \ - } \ - } while (0, 0) -#define RETURN_FALSE_IF_FAILED(input) RETURN_FALSE_IF(FAILED(input)); +#define RETURN_FALSE_IF_FAILED(hr) RETURN_FALSE_IF(FAILED(hr)); +#define RETURN_RESULT_IF_NULL(ptr, result) RETURN_RESULT_IF((ptr == nullptr), result); +#define RETURN_RESULT_IF_FAILED(hr, result) RETURN_RESULT_IF(FAILED(hr), result) //***************************************************************************** // Macros for logging failures (ignore or pass-through) //*****************************************************************************