Skip to content

Commit 4b40585

Browse files
committed
Moving error string handling to utility functions
1 parent e5eb52a commit 4b40585

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/pocky/ext/pocky_utils.c

+14
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ cl_int pocky_opencl_kernels_from_fragments(cl_uint nfrags,
310310
cl_uint *num_kerns, cl_kernel **kerns)
311311
{
312312
size_t *lens;
313+
char buf[BUFSIZ];
313314
cl_int err, err1;
314315

315316
lens = malloc(nfrags * sizeof(size_t));
@@ -376,6 +377,14 @@ cl_int pocky_opencl_kernels_from_fragments(cl_uint nfrags,
376377
}
377378

378379
free(lens);
380+
381+
if (err != CL_SUCCESS)
382+
{
383+
snprintf(buf, BUFSIZ, pocky_ocl_fmt_internal,
384+
pocky_opencl_error_to_string(err), err);
385+
PyErr_SetString(pocky_ocl_error, buf);
386+
}
387+
379388
return err;
380389
}
381390

@@ -476,6 +485,11 @@ cl_int pocky_opencl_kernel_lookup_by_name(cl_uint num_kerns,
476485
err = err0;
477486
}
478487

488+
if (err != CL_SUCCESS)
489+
{
490+
PyErr_SetString(pocky_ocl_error, pocky_ocl_msg_kernel_not_found);
491+
}
492+
479493
return err;
480494
}
481495

0 commit comments

Comments
 (0)