@@ -48,46 +48,46 @@ ORC_RT_C_EXTERN_C_BEGIN
48
48
typedef union {
49
49
char * ValuePtr ;
50
50
char Value [sizeof (char * )];
51
- } orc_rt_CWrapperFunctionResultDataUnion ;
51
+ } orc_rt_WrapperFunctionResultDataUnion ;
52
52
53
53
/**
54
- * orc_rt_CWrapperFunctionResult is a kind of C-SmallVector with an
54
+ * orc_rt_WrapperFunctionResult is a kind of C-SmallVector with an
55
55
* out-of-band error state.
56
56
*
57
57
* If Size == 0 and Data.ValuePtr is non-zero then the value is in the
58
58
* 'out-of-band error' state, and Data.ValuePtr points at a malloc-allocated,
59
59
* null-terminated string error message.
60
60
*
61
- * If Size <= sizeof(orc_rt_CWrapperFunctionResultData ) then the value is in
61
+ * If Size <= sizeof(orc_rt_WrapperFunctionResultData ) then the value is in
62
62
* the 'small' state and the content is held in the first Size bytes of
63
63
* Data.Value.
64
64
*
65
- * If Size > sizeof(orc_rt_CWrapperFunctionResultData ) then the value is in the
65
+ * If Size > sizeof(orc_rt_WrapperFunctionResultData ) then the value is in the
66
66
* 'large' state and the content is held in the first Size bytes of the
67
67
* memory pointed to by Data.ValuePtr. This memory must have been allocated by
68
68
* malloc, and will be freed with free when this value is destroyed.
69
69
*/
70
70
typedef struct {
71
- orc_rt_CWrapperFunctionResultDataUnion Data ;
71
+ orc_rt_WrapperFunctionResultDataUnion Data ;
72
72
size_t Size ;
73
- } orc_rt_CWrapperFunctionResult ;
73
+ } orc_rt_WrapperFunctionResult ;
74
74
75
75
/**
76
- * Zero-initialize an orc_rt_CWrapperFunctionResult .
76
+ * Zero-initialize an orc_rt_WrapperFunctionResult .
77
77
*/
78
78
static inline void
79
- orc_rt_CWrapperFunctionResultInit ( orc_rt_CWrapperFunctionResult * R ) {
79
+ orc_rt_WrapperFunctionResultInit ( orc_rt_WrapperFunctionResult * R ) {
80
80
R -> Size = 0 ;
81
81
R -> Data .ValuePtr = 0 ;
82
82
}
83
83
84
84
/**
85
- * Create an orc_rt_CWrapperFunctionResult with an uninitialized buffer of
85
+ * Create an orc_rt_WrapperFunctionResult with an uninitialized buffer of
86
86
* size Size. The buffer is returned via the DataPtr argument.
87
87
*/
88
- static inline orc_rt_CWrapperFunctionResult
89
- orc_rt_CWrapperFunctionResultAllocate (size_t Size ) {
90
- orc_rt_CWrapperFunctionResult R ;
88
+ static inline orc_rt_WrapperFunctionResult
89
+ orc_rt_WrapperFunctionResultAllocate (size_t Size ) {
90
+ orc_rt_WrapperFunctionResult R ;
91
91
R .Size = Size ;
92
92
// If Size is 0 ValuePtr must be 0 or it is considered an out-of-band error.
93
93
R .Data .ValuePtr = 0 ;
@@ -99,9 +99,9 @@ orc_rt_CWrapperFunctionResultAllocate(size_t Size) {
99
99
/**
100
100
* Create an orc_rt_WrapperFunctionResult from the given data range.
101
101
*/
102
- static inline orc_rt_CWrapperFunctionResult
103
- orc_rt_CreateCWrapperFunctionResultFromRange (const char * Data , size_t Size ) {
104
- orc_rt_CWrapperFunctionResult R ;
102
+ static inline orc_rt_WrapperFunctionResult
103
+ orc_rt_CreateWrapperFunctionResultFromRange (const char * Data , size_t Size ) {
104
+ orc_rt_WrapperFunctionResult R ;
105
105
R .Size = Size ;
106
106
if (R .Size > sizeof (R .Data .Value )) {
107
107
char * Tmp = (char * )malloc (Size );
@@ -113,28 +113,28 @@ orc_rt_CreateCWrapperFunctionResultFromRange(const char *Data, size_t Size) {
113
113
}
114
114
115
115
/**
116
- * Create an orc_rt_CWrapperFunctionResult by copying the given string,
116
+ * Create an orc_rt_WrapperFunctionResult by copying the given string,
117
117
* including the null-terminator.
118
118
*
119
119
* This function copies the input string. The client is responsible for freeing
120
120
* the ErrMsg arg.
121
121
*/
122
- static inline orc_rt_CWrapperFunctionResult
123
- orc_rt_CreateCWrapperFunctionResultFromString (const char * Source ) {
124
- return orc_rt_CreateCWrapperFunctionResultFromRange (Source ,
125
- strlen (Source ) + 1 );
122
+ static inline orc_rt_WrapperFunctionResult
123
+ orc_rt_CreateWrapperFunctionResultFromString (const char * Source ) {
124
+ return orc_rt_CreateWrapperFunctionResultFromRange (Source ,
125
+ strlen (Source ) + 1 );
126
126
}
127
127
128
128
/**
129
- * Create an orc_rt_CWrapperFunctionResult representing an out-of-band
129
+ * Create an orc_rt_WrapperFunctionResult representing an out-of-band
130
130
* error.
131
131
*
132
132
* This function copies the input string. The client is responsible for freeing
133
133
* the ErrMsg arg.
134
134
*/
135
- static inline orc_rt_CWrapperFunctionResult
136
- orc_rt_CreateCWrapperFunctionResultFromOutOfBandError (const char * ErrMsg ) {
137
- orc_rt_CWrapperFunctionResult R ;
135
+ static inline orc_rt_WrapperFunctionResult
136
+ orc_rt_CreateWrapperFunctionResultFromOutOfBandError (const char * ErrMsg ) {
137
+ orc_rt_WrapperFunctionResult R ;
138
138
R .Size = 0 ;
139
139
char * Tmp = (char * )malloc (strlen (ErrMsg ) + 1 );
140
140
strcpy (Tmp , ErrMsg );
@@ -143,57 +143,57 @@ orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(const char *ErrMsg) {
143
143
}
144
144
145
145
/**
146
- * This should be called to destroy orc_rt_CWrapperFunctionResult values
146
+ * This should be called to destroy orc_rt_WrapperFunctionResult values
147
147
* regardless of their state.
148
148
*/
149
149
static inline void
150
- orc_rt_DisposeCWrapperFunctionResult ( orc_rt_CWrapperFunctionResult * R ) {
150
+ orc_rt_DisposeWrapperFunctionResult ( orc_rt_WrapperFunctionResult * R ) {
151
151
if (R -> Size > sizeof (R -> Data .Value ) ||
152
152
(R -> Size == 0 && R -> Data .ValuePtr ))
153
153
free (R -> Data .ValuePtr );
154
154
}
155
155
156
156
/**
157
157
* Get a pointer to the data contained in the given
158
- * orc_rt_CWrapperFunctionResult .
158
+ * orc_rt_WrapperFunctionResult .
159
159
*/
160
160
static inline char *
161
- orc_rt_CWrapperFunctionResultData ( orc_rt_CWrapperFunctionResult * R ) {
161
+ orc_rt_WrapperFunctionResultData ( orc_rt_WrapperFunctionResult * R ) {
162
162
assert ((R -> Size != 0 || R -> Data .ValuePtr == NULL ) &&
163
163
"Cannot get data for out-of-band error value" );
164
164
return R -> Size > sizeof (R -> Data .Value ) ? R -> Data .ValuePtr : R -> Data .Value ;
165
165
}
166
166
167
167
/**
168
- * Safely get the size of the given orc_rt_CWrapperFunctionResult .
168
+ * Safely get the size of the given orc_rt_WrapperFunctionResult .
169
169
*
170
170
* Asserts that we're not trying to access the size of an error value.
171
171
*/
172
172
static inline size_t
173
- orc_rt_CWrapperFunctionResultSize (const orc_rt_CWrapperFunctionResult * R ) {
173
+ orc_rt_WrapperFunctionResultSize (const orc_rt_WrapperFunctionResult * R ) {
174
174
assert ((R -> Size != 0 || R -> Data .ValuePtr == NULL ) &&
175
175
"Cannot get size for out-of-band error value" );
176
176
return R -> Size ;
177
177
}
178
178
179
179
/**
180
180
* Returns 1 if this value is equivalent to a value just initialized by
181
- * orc_rt_CWrapperFunctionResultInit , 0 otherwise.
181
+ * orc_rt_WrapperFunctionResultInit , 0 otherwise.
182
182
*/
183
183
static inline size_t
184
- orc_rt_CWrapperFunctionResultEmpty (const orc_rt_CWrapperFunctionResult * R ) {
184
+ orc_rt_WrapperFunctionResultEmpty (const orc_rt_WrapperFunctionResult * R ) {
185
185
return R -> Size == 0 && R -> Data .ValuePtr == 0 ;
186
186
}
187
187
188
188
/**
189
189
* Returns a pointer to the out-of-band error string for this
190
- * orc_rt_CWrapperFunctionResult , or null if there is no error.
190
+ * orc_rt_WrapperFunctionResult , or null if there is no error.
191
191
*
192
- * The orc_rt_CWrapperFunctionResult retains ownership of the error
192
+ * The orc_rt_WrapperFunctionResult retains ownership of the error
193
193
* string, so it should be copied if the caller wishes to preserve it.
194
194
*/
195
- static inline const char * orc_rt_CWrapperFunctionResultGetOutOfBandError (
196
- const orc_rt_CWrapperFunctionResult * R ) {
195
+ static inline const char * orc_rt_WrapperFunctionResultGetOutOfBandError (
196
+ const orc_rt_WrapperFunctionResult * R ) {
197
197
return R -> Size == 0 ? R -> Data .ValuePtr : 0 ;
198
198
}
199
199
0 commit comments