Skip to content

Commit c077c39

Browse files
committed
fix CS/WS
1 parent 71b6810 commit c077c39

File tree

4 files changed

+46
-36
lines changed

4 files changed

+46
-36
lines changed

sapi/fpm/fpm/fpm_conf.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -402,40 +402,40 @@ static int fpm_conf_process_all_pools() /* {{{ */
402402

403403
if (wp->config->pm == NULL) {
404404
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] the process manager is missing (static or dynamic)", wp->config->name);
405-
return(-1);
405+
return -1;
406406
}
407407

408408
if (wp->config->pm->style == PM_STYLE_DYNAMIC) {
409409
struct fpm_pm_s *pm = wp->config->pm;
410410

411411
if (pm->dynamic.min_spare_servers <= 0) {
412412
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] min_spare_servers(%d) must be a positive value", wp->config->name, pm->dynamic.min_spare_servers);
413-
return(-1);
413+
return -1;
414414
}
415415

416416
if (pm->dynamic.max_spare_servers <= 0) {
417417
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] max_spare_servers(%d) must be a positive value", wp->config->name, pm->dynamic.max_spare_servers);
418-
return(-1);
418+
return -1;
419419
}
420420

421421
if (pm->dynamic.min_spare_servers > pm->max_children ||
422422
pm->dynamic.max_spare_servers > pm->max_children) {
423423
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] min_spare_servers(%d) and max_spare_servers(%d) cannot be greater than max_children(%d)",
424424
wp->config->name, pm->dynamic.min_spare_servers, pm->dynamic.max_spare_servers, pm->max_children);
425-
return(-1);
425+
return -1;
426426
}
427427

428428
if (pm->dynamic.max_spare_servers < pm->dynamic.min_spare_servers) {
429429
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] max_spare_servers(%d) must not be less than min_spare_servers(%d)", wp->config->name, pm->dynamic.max_spare_servers, pm->dynamic.min_spare_servers);
430-
return(-1);
430+
return -1;
431431
}
432432

433433
if (pm->dynamic.start_servers <= 0) {
434434
pm->dynamic.start_servers = pm->dynamic.min_spare_servers + ((pm->dynamic.max_spare_servers - pm->dynamic.min_spare_servers) / 2);
435435
zlog(ZLOG_STUFF, ZLOG_NOTICE, "[pool %s] start_servers has been set to %d", wp->config->name, pm->dynamic.start_servers);
436436
} else if (pm->dynamic.start_servers < pm->dynamic.min_spare_servers || pm->dynamic.start_servers > pm->dynamic.max_spare_servers) {
437437
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] start_servers(%d) must not be less than min_spare_servers(%d) and not greater than max_spare_servers(%d)", wp->config->name, pm->dynamic.start_servers, pm->dynamic.min_spare_servers, pm->dynamic.max_spare_servers);
438-
return(-1);
438+
return -1;
439439
}
440440
}
441441

@@ -482,18 +482,18 @@ static int fpm_conf_process_all_pools() /* {{{ */
482482

483483
if (*ping != '/') {
484484
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' must start with a '/'", wp->config->name, ping);
485-
return(-1);
485+
return -1;
486486
}
487487

488488
if (strlen(ping) < 2) {
489489
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' is not long enough", wp->config->name, ping);
490-
return(-1);
490+
return -1;
491491
}
492492

493493
for (i=0; i<strlen(ping); i++) {
494494
if (!isalnum(ping[i]) && ping[i] != '/' && ping[i] != '-' && ping[i] != '_' && ping[i] != '.') {
495495
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, ping);
496-
return(-1);
496+
return -1;
497497
}
498498
}
499499

@@ -502,7 +502,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
502502
} else {
503503
if (strlen(wp->config->pm->pong) < 1) {
504504
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping response page '%s' is not long enough", wp->config->name, wp->config->pm->pong);
505-
return(-1);
505+
return -1;
506506
}
507507
}
508508
} else {
@@ -519,24 +519,24 @@ static int fpm_conf_process_all_pools() /* {{{ */
519519

520520
if (*status != '/') {
521521
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' must start with a '/'", wp->config->name, status);
522-
return(-1);
522+
return -1;
523523
}
524524

525525
if (strlen(status) < 2) {
526526
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' is not long enough", wp->config->name, status);
527-
return(-1);
527+
return -1;
528528
}
529529

530530
for (i=0; i<strlen(status); i++) {
531531
if (!isalnum(status[i]) && status[i] != '/' && status[i] != '-' && status[i] != '_' && status[i] != '.') {
532532
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, status);
533-
return(-1);
533+
return -1;
534534
}
535535
}
536536
wp->shm_status = fpm_shm_alloc(sizeof(struct fpm_status_s));
537537
if (!wp->shm_status) {
538538
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to allocate shared memory for status page '%s'", wp->config->name, status);
539-
return(-1);
539+
return -1;
540540
}
541541
fpm_status_update_accepted_conn(wp->shm_status, 0);
542542
fpm_status_update_activity(wp->shm_status, -1, -1, -1, 1);

sapi/fpm/fpm/fpm_env.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static char * nvmatch(char *s1, char *s2) /* {{{ */
106106
if(*s1 == '\0' && *(s2-1) == '=') {
107107
return s2;
108108
}
109-
return(NULL);
109+
return NULL;
110110
}
111111
/* }}} */
112112
#endif

sapi/fpm/fpm/fpm_request.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int fpm_request_is_idle(struct fpm_child_s *child) /* {{{ */
159159

160160
slot = fpm_shm_slot(child);
161161
if (!fpm_shm_slots_acquire(slot, 1)) {
162-
return(-1);
162+
return -1;
163163
}
164164

165165
slot_c = *slot;

sapi/fpm/fpm/fpm_status.c

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
2121
{
2222
if (!wp || !wp->config) {
2323
zlog(ZLOG_STUFF, ZLOG_ERROR, "unable to init fpm_status because conf structure is NULL");
24-
return(-1);
24+
return -1;
2525
}
2626
if (wp->config->pm->status || wp->config->pm->ping) {
2727
if (wp->config->pm->status) {
2828
if (!wp->shm_status) {
2929
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to init fpm_status because the dedicated SHM has not been set", wp->config->name);
30-
return(-1);
30+
return -1;
3131
}
3232
fpm_status_shm = wp->shm_status;
3333
}
@@ -38,13 +38,13 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
3838
if (wp->config->pm->ping) {
3939
if (!wp->config->pm->pong) {
4040
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] ping is set (%s) but pong is not set.", wp->config->name, wp->config->pm->ping);
41-
return(-1);
41+
return -1;
4242
}
4343
fpm_status_ping = strdup(wp->config->pm->ping);
4444
fpm_status_pong = strdup(wp->config->pm->pong);
4545
}
4646
}
47-
return(0);
47+
return 0;
4848
}
4949
/* }}} */
5050

@@ -63,6 +63,7 @@ void fpm_status_set_pm(struct fpm_shm_s *shm, int pm) /* {{{ */
6363
/* one shot operation */
6464
*(struct fpm_status_s *)shm->mem = status;
6565
}
66+
/* }}} */
6667

6768
void fpm_status_increment_accepted_conn(struct fpm_shm_s *shm) /* {{{ */
6869
{
@@ -127,20 +128,29 @@ int fpm_status_get(int *idle, int *active, int *total, int *pm) /* {{{ */
127128
struct fpm_status_s status;
128129
if (!fpm_status_shm || !fpm_status_shm->mem) {
129130
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to access status shared memory", fpm_status_pool);
130-
return(0);
131+
return 0;
131132
}
132133
if (!idle || !active || !total) {
133134
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to get status information : pointers are NULL", fpm_status_pool);
134-
return(0);
135+
return 0;
135136
}
136137

137138
/* one shot operation */
138139
status = *(struct fpm_status_s *)fpm_status_shm->mem;
139140

140-
if (idle) *idle = status.idle;
141-
if (active) *active = status.active;
142-
if (total) *total = status.total;
143-
if (pm) *pm = status.pm;
141+
if (idle) {
142+
*idle = status.idle;
143+
}
144+
if (active) {
145+
*active = status.active;
146+
}
147+
if (total) {
148+
*total = status.total;
149+
}
150+
if (pm) {
151+
*pm = status.pm;
152+
}
153+
return 1;
144154
}
145155
/* }}} */
146156

@@ -215,27 +225,27 @@ int fpm_status_handle_status(char *uri, char *query_string, char **output, char
215225
struct fpm_status_s status;
216226

217227
if (!fpm_status_uri || !uri) {
218-
return(0);
228+
return 0;
219229
}
220230

221231
/* It's not the status page */
222232
if (strcmp(fpm_status_uri, uri)) {
223-
return(0);
233+
return 0;
224234
}
225235

226236
if (!output || !content_type || !fpm_status_shm) {
227-
return(1);
237+
return 1;
228238
}
229239

230240
if (!fpm_status_shm->mem) {
231-
return(1);
241+
return 1;
232242
}
233243

234244
/* one shot operation */
235245
status = *(struct fpm_status_s *)fpm_status_shm->mem;
236246

237247
if (status.idle < 0 || status.active < 0 || status.total < 0) {
238-
return(1);
248+
return 1;
239249
}
240250

241251
if (query_string && strstr(query_string, "html")) {
@@ -248,25 +258,25 @@ int fpm_status_handle_status(char *uri, char *query_string, char **output, char
248258

249259
if (!*output || !content_type) {
250260
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to allocate status ouput buffer", fpm_status_pool);
251-
return(1);
261+
return 1;
252262
}
253263

254-
return(1);
264+
return 1;
255265
}
256266
/* }}} */
257267

258268
char *fpm_status_handle_ping(char *uri) /* {{{ */
259269
{
260270
if (!fpm_status_ping || !fpm_status_pong || !uri) {
261-
return(NULL);
271+
return NULL;
262272
}
263273

264274
/* It's not the status page */
265275
if (strcmp(fpm_status_ping, uri)) {
266-
return(NULL);
276+
return NULL;
267277
}
268278

269-
return(fpm_status_pong);
279+
return fpm_status_pong;
270280
}
271281
/* }}} */
272282

0 commit comments

Comments
 (0)