xref: /xnu-8020.140.41/EXTERNAL_HEADERS/CoreEntitlements/Result.h (revision 27b03b360a988dfd3dfdf34262bb0042026747cc)
1 //
2 //  Result.h
3 //  CoreEntitlements
4 //
5 
6 #pragma once
7 
8 #ifndef _CE_INDIRECT
9 #error "Please include <CoreEntitlements/CoreEntitlements.h> instead of this file"
10 #endif
11 
12 #include "Errors.h"
13 #include <stdint.h>
14 
15 /*!
16  * @function CE_CHECK
17  * Checks if the passed in return value from one of CoreEntitlements function is an error, and if so returns that error in the current function
18  */
19 #define CE_CHECK(ret) do { CEError_t _ce_error = ret; if (_ce_error != kCENoError) {return _ce_error;} } while(0)
20 
21 /*!
22  * @function CE_THROW
23  * Macro to "throw" (return) one of the CEErrors
24  */
25 #define CE_THROW(err) return err
26 
27 /*!
28  * @function CE_OK
29  * Returns a true if the passed in value corresponds to kCENoError
30  */
31 #define CE_OK(ret) ((ret) == kCENoError)
32