Add a function to try to get a result or throw the error if there is one.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
02c72c21fe
commit
e81c5e2690
@ -132,6 +132,16 @@ typedef struct {
|
|||||||
if (!ksresult_check(__ksresult_cache__)) return __ksresult_cache__; \
|
if (!ksresult_check(__ksresult_cache__)) return __ksresult_cache__; \
|
||||||
varname = ((result_type) __ksresult_cache__.result); \
|
varname = ((result_type) __ksresult_cache__.result); \
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Try to get a result and put it in the variable called varname.
|
||||||
|
* You must specify the type of the result you want to get.
|
||||||
|
* If there is an error, it is thrown directly. You cannot use this function if your function does not return a ksrerror.
|
||||||
|
*/
|
||||||
|
#define ksresult_get_throwerr(varname, result_type, _result) NULL; { \
|
||||||
|
ksresult __ksresult_cache__ = (_result); \
|
||||||
|
if (!ksresult_check(__ksresult_cache__)) return __ksresult_cache__.error; \
|
||||||
|
varname = ((result_type) __ksresult_cache__.result); \
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Try to get a result while ignoring the error if there is one.
|
* Try to get a result while ignoring the error if there is one.
|
||||||
* You must specify the type of the result you want to get.
|
* You must specify the type of the result you want to get.
|
||||||
|
Loading…
Reference in New Issue
Block a user