Style police.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
diff --git a/ocl.c b/ocl.c
index 7ea48a6..c0d0351 100644
--- a/ocl.c
+++ b/ocl.c
@@ -75,14 +75,12 @@ int clDevicesNum() {
cl_platform_id platform = NULL;
status = clGetPlatformIDs(0, NULL, &numPlatforms);
/* If this fails, assume no GPUs. */
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_INFO, "clGetPlatformsIDs failed (no GPU?)");
return 0;
}
- if (numPlatforms > 0)
- {
+ if (numPlatforms > 0) {
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
if (status != CL_SUCCESS)
@@ -92,8 +90,7 @@ int clDevicesNum() {
}
unsigned int i;
- for(i=0; i < numPlatforms; ++i)
- {
+ for (i = 0; i < numPlatforms; ++i) {
char pbuff[100];
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS)
@@ -118,8 +115,7 @@ int clDevicesNum() {
cl_uint numDevices;
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (num)");
return -1;
}
@@ -154,8 +150,7 @@ void patch_opcodes(char *w, unsigned remaining)
int count_bfe_int = 0;
int count_bfe_uint = 0;
int count_byte_align = 0;
- while (42)
- {
+ while (42) {
int clamp = (*opcode >> (32 + 31)) & 0x1;
int dest_rel = (*opcode >> (32 + 28)) & 0x1;
int alu_inst = (*opcode >> (32 + 13)) & 0x1f;
@@ -175,9 +170,8 @@ void patch_opcodes(char *w, unsigned remaining)
patched++;
}
}
- if (remaining <= 8) {
+ if (remaining <= 8)
break;
- }
opcode++;
remaining -= 8;
}
@@ -200,14 +194,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_uint numPlatforms;
cl_platform_id platform = NULL;
status = clGetPlatformIDs(0, NULL, &numPlatforms);
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Platforms. (clGetPlatformsIDs)");
return NULL;
}
- if (numPlatforms > 0)
- {
+ if (numPlatforms > 0) {
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
if (status != CL_SUCCESS)
@@ -216,8 +208,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
return NULL;
}
- for(i = 0; i < numPlatforms; ++i)
- {
+ for(i = 0; i < numPlatforms; ++i) {
char pbuff[100];
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS)
@@ -242,8 +233,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_uint numDevices;
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (num)");
return NULL;
}
@@ -255,8 +245,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
/* Now, get the device list data */
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numDevices, devices, NULL);
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (list)");
return NULL;
}
@@ -264,11 +253,10 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
applog(LOG_INFO, "List of devices:");
unsigned int i;
- for(i=0; i<numDevices; i++) {
+ for(i=0; i < numDevices; i++) {
char pbuff[100];
status = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device Info");
return NULL;
}
@@ -279,8 +267,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (gpu < numDevices) {
char pbuff[100];
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device Info");
return NULL;
}
@@ -297,8 +284,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0 };
clState->context = clCreateContextFromType(cps, CL_DEVICE_TYPE_GPU, NULL, NULL, &status);
- if (status != CL_SUCCESS)
- {
+ if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Creating Context. (clCreateContextFromType)");
return NULL;
}
diff --git a/util.c b/util.c
index 372da6c..b7b18e3 100644
--- a/util.c
+++ b/util.c
@@ -336,9 +336,8 @@ json_t *json_rpc_call(CURL *curl, const char *url,
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
- if (!opt_delaynet) {
+ if (!opt_delaynet)
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
- }
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb);
@@ -739,9 +738,8 @@ bool get_dondata(char **url, char **userpass)
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
- if (!opt_delaynet) {
+ if (!opt_delaynet)
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
- }
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str);