mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-11-06 06:01:16 +01:00
26 lines
518 B
C
26 lines
518 B
C
/**
|
|
* @file result_utilities.h
|
|
* @brief Utilities for handling Results.
|
|
* @author SciresM
|
|
* @copyright libnx Authors
|
|
*/
|
|
#pragma once
|
|
#include <switch/result.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/// Evaluates an expression that returns a result, and returns the result if it would fail.
|
|
#define R_TRY(res_expr) \
|
|
do { \
|
|
const Result _tmp_r_try_rc = res_expr; \
|
|
if (R_FAILED(_tmp_r_try_rc)) { \
|
|
return _tmp_r_try_rc; \
|
|
} \
|
|
} while (0)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|