Skip to content

Commit 792682a

Browse files
authored
Fix handle validation macros (#174)
1 parent b5c4285 commit 792682a

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

loader/icd.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,31 +202,25 @@ do \
202202
#define KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(handle,invalid_handle_error_code) \
203203
do \
204204
{ \
205-
if (khrEnableTrace) \
205+
if (!handle) \
206206
{ \
207-
if (!handle) \
208-
{ \
209-
return invalid_handle_error_code; \
210-
} \
211-
}\
207+
return invalid_handle_error_code; \
208+
} \
212209
} while (0)
213210

214211
// if handle is NULL then set errcode_ret to invalid_handle_error and return NULL
215212
// (NULL being an invalid handle)
216213
#define KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(handle,invalid_handle_error) \
217214
do \
218215
{ \
219-
if (khrEnableTrace) \
216+
if (!handle) \
220217
{ \
221-
if (!handle) \
218+
if (errcode_ret) \
222219
{ \
223-
if (errcode_ret) \
224-
{ \
225-
*errcode_ret = invalid_handle_error; \
226-
} \
227-
return NULL; \
220+
*errcode_ret = invalid_handle_error; \
228221
} \
229-
}\
222+
return NULL; \
223+
} \
230224
} while (0)
231225

232226
#endif

0 commit comments

Comments
 (0)