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