jitterbug/try.h

2 lines
253 B
C

#define TRY_NONNULL(M_t, M_expr, M_sentinel) ({ M_t _result = (M_expr); if (!_result) { return (M_sentinel); } _result; })
#define TRY_NONNEGATIVE(M_t, M_expr, M_sentinel) ({ M_t _result = (M_expr); if (_result < 0) { return (M_sentinel); } _result; })