aboutsummaryrefslogtreecommitdiff
path: root/src/cl-utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-21 13:26:37 +0200
committerThomas White <taw@physics.org>2021-07-21 15:34:33 +0200
commit7e5536832b22036a634a74e16073b4762a416e29 (patch)
tree25799eb139d235f524a80c53fb25d0c9f64eb6f1 /src/cl-utils.c
parent760f17f56b7f79f67a9029cbe7cc55a0acccd3b9 (diff)
Reduce variable scope where possible
Diffstat (limited to 'src/cl-utils.c')
-rw-r--r--src/cl-utils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cl-utils.c b/src/cl-utils.c
index c2c1bf1d..1b6667c4 100644
--- a/src/cl-utils.c
+++ b/src/cl-utils.c
@@ -188,7 +188,7 @@ cl_device_id get_cl_dev(cl_context ctx, int n)
cl_device_id *dev;
cl_int r;
size_t size;
- int i, num_devs;
+ int num_devs;
/* Get the required size of the array */
r = clGetContextInfo(ctx, CL_CONTEXT_DEVICES, 0, NULL, &size);
@@ -212,6 +212,8 @@ cl_device_id get_cl_dev(cl_context ctx, int n)
if ( n < 0 ) {
+ int i;
+
STATUS("Available devices:\n");
for ( i=0; i<num_devs; i++ ) {
@@ -267,7 +269,6 @@ cl_program load_program_from_string(const char *source_in, size_t len,
cl_int r;
char cflags[1024] = "";
char *insert_pos;
- size_t il;
char *source;
/* Copy the code because we need to zero-terminate it */
@@ -282,6 +283,8 @@ cl_program load_program_from_string(const char *source_in, size_t len,
if ( insert_pos != NULL ) {
char *source2;
+ size_t il;
+
source2 = malloc(strlen(source)+strlen(insert_stuff)+1);
if ( source2 == NULL ) {
free(source);