Skip to content

Commit f7d1437

Browse files
committed
code prettified
1 parent 1375284 commit f7d1437

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/ngx_link_func_module.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static ngx_command_t ngx_http_link_func_commands[] = {
305305
offsetof(ngx_http_link_func_loc_conf_t, _method_name), /* No offset when storing the module configuration on struct. */
306306
NULL
307307
},
308-
{ ngx_string("ngx_link_func_add_prop"),
308+
{ ngx_string("ngx_link_func_add_prop"),
309309
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_CONF_TAKE2,
310310
ngx_conf_set_keyval_slot,
311311
NGX_HTTP_SRV_CONF_OFFSET,
@@ -630,7 +630,7 @@ ngx_http_link_func_init_method(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
630630
if (scf && scf->_libname.len > 0) {
631631
return ngx_conf_set_str_slot(cf, cmd, conf);
632632
}
633-
633+
634634
return "No application linking in server block";
635635
} /* ngx_http_link_func_init_method */
636636

@@ -653,7 +653,7 @@ ngx_http_link_func_proceed_init_calls(ngx_cycle_t* cycle, ngx_http_link_func_sr
653653
appcyc.__log__ = cycle->log;
654654
appcyc.shared_mem = (void*)mcf->shm_ctx->shared_mem;
655655
func(&appcyc);
656-
if(appcyc.has_error) {
656+
if (appcyc.has_error) {
657657
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "%s", "link function worker Initialize unsuccessfully");
658658
return NGX_ERROR;
659659
}
@@ -673,11 +673,11 @@ ngx_http_link_func_post_configuration(ngx_conf_t *cf) {
673673

674674
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
675675

676-
if( cmcf == NULL ) {
676+
if ( cmcf == NULL ) {
677677
return NGX_ERROR;
678678
}
679679

680-
if( ngx_http_link_func_application_compatibility_check(cf, cmcf) == NGX_ERROR ) {
680+
if ( ngx_http_link_func_application_compatibility_check(cf, cmcf) == NGX_ERROR ) {
681681
return NGX_ERROR;
682682
}
683683

@@ -811,16 +811,16 @@ ngx_http_link_func_application_compatibility_check(ngx_conf_t *cf, ngx_http_core
811811
ngx_http_link_func_app_cycle_handler func;
812812
*(void**)(&func) = dlsym(scf->_app, (const char*)"ngx_link_func_init_cycle");
813813
if ((error = dlerror()) != NULL) {
814-
ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
815-
"function ngx_link_func_init_cycle(ngx_link_func_cycle_t *cycle) not found in \"%V\", at least create an empty init function block \n %s",
816-
&scf->_libname, error);
814+
ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
815+
"function ngx_link_func_init_cycle(ngx_link_func_cycle_t *cycle) not found in \"%V\", at least create an empty init function block \n %s",
816+
&scf->_libname, error);
817817
return NGX_ERROR;
818818
}
819819
*(void**)(&func) = dlsym(scf->_app, (const char*)"ngx_link_func_exit_cycle");
820820
if ((error = dlerror()) != NULL) {
821-
ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
822-
"function ngx_link_func_exit_cycle(ngx_link_func_cycle_t *cycle) not found in \"%V\", at least create an empty exit function block \n %s",
823-
&scf->_libname, error);
821+
ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
822+
"function ngx_link_func_exit_cycle(ngx_link_func_cycle_t *cycle) not found in \"%V\", at least create an empty exit function block \n %s",
823+
&scf->_libname, error);
824824
}
825825

826826

@@ -932,7 +932,7 @@ ngx_http_link_func_module_init(ngx_cycle_t *cycle) {
932932
// return NGX_ERROR;
933933
// }
934934
ngx_queue_remove(q);
935-
}
935+
}
936936
} else {
937937
continue;
938938
}
@@ -1013,7 +1013,7 @@ ngx_http_link_func_process_exit(ngx_cycle_t *cycle) {
10131013
appcyc.__log__ = cycle->log;
10141014
appcyc.shared_mem = (void*)mcf->shm_ctx->shared_mem;
10151015
func(&appcyc);
1016-
if(appcyc.has_error) {
1016+
if (appcyc.has_error) {
10171017
ngx_log_error(NGX_LOG_ERR, cycle->log, 0, "%s", "link function worker exit error");
10181018
}
10191019
}
@@ -1872,24 +1872,24 @@ ngx_link_func_get_prop(ngx_link_func_ctx_t *ctx, const char *key, size_t keylen)
18721872

18731873
scf = ngx_http_get_module_srv_conf(r, ngx_http_link_func_module);
18741874

1875-
if( scf == NULL ) {
1875+
if ( scf == NULL ) {
18761876
ngx_log_error(NGX_LOG_EMERG, r->connection->log, 0, "Invalid link function server config");
18771877
return NULL;
18781878
}
18791879

1880-
if(scf->_props == NULL) {
1880+
if (scf->_props == NULL) {
18811881
return NULL;
18821882
}
18831883

18841884
nelts = scf->_props->nelts;
18851885
keyval = scf->_props->elts;
18861886

18871887
for (i = 0; i < nelts; i++) {
1888-
if ( keyval->key.len == keylen && ngx_strncasecmp(keyval->key.data, (u_char*) key, keylen) == 0) {
1889-
/** it is config memory pool, should not reallocate or overwrite **/
1890-
return keyval->value.data;
1891-
}
1892-
keyval++;
1888+
if ( keyval->key.len == keylen && ngx_strncasecmp(keyval->key.data, (u_char*) key, keylen) == 0) {
1889+
/** it is config memory pool, should not reallocate or overwrite **/
1890+
return keyval->value.data;
1891+
}
1892+
keyval++;
18931893
}
18941894
return NULL;
18951895
}
@@ -1906,26 +1906,26 @@ ngx_link_func_cyc_get_prop(ngx_link_func_cycle_t *cyc, const char *key, size_t k
19061906
}
19071907

19081908
log = (ngx_log_t*) cyc->__log__;
1909-
scf =(ngx_http_link_func_srv_conf_t*) cyc->__srv_cf__;
1909+
scf = (ngx_http_link_func_srv_conf_t*) cyc->__srv_cf__;
19101910

1911-
if( scf == NULL || log == NULL) {
1911+
if ( scf == NULL || log == NULL) {
19121912
ngx_log_error(NGX_LOG_EMERG, log, 0, "Invalid link function server config");
19131913
return NULL;
19141914
}
19151915

1916-
if(scf->_props == NULL) {
1916+
if (scf->_props == NULL) {
19171917
return NULL;
19181918
}
19191919

19201920
nelts = scf->_props->nelts;
19211921
keyval = scf->_props->elts;
19221922

19231923
for (i = 0; i < nelts; i++) {
1924-
if ( keyval->key.len == keylen && ngx_strncasecmp(keyval->key.data, (u_char*) key, keylen) == 0) {
1925-
/** it is config memory pool, should not reallocate or overwrite **/
1926-
return keyval->value.data;
1927-
}
1928-
keyval++;
1924+
if ( keyval->key.len == keylen && ngx_strncasecmp(keyval->key.data, (u_char*) key, keylen) == 0) {
1925+
/** it is config memory pool, should not reallocate or overwrite **/
1926+
return keyval->value.data;
1927+
}
1928+
keyval++;
19291929
}
19301930
return NULL;
19311931
}
@@ -2327,7 +2327,7 @@ ngx_http_link_func_connect_and_request(int *sockfd, ngx_http_link_func_srv_conf_
23272327
if ( connect(*sockfd, (struct sockaddr *) &dest_addr,
23282328
sizeof(struct sockaddr)) == -1 ) {
23292329
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "Unable connect to host %s - %s on port %d.\n",
2330-
hostname, inet_ntoa(dest_addr.sin_addr), port);
2330+
hostname, inet_ntoa(dest_addr.sin_addr), port);
23312331
rc = 0;
23322332
}
23332333
rc = 1;
@@ -2498,7 +2498,7 @@ ngx_http_link_func_connect_and_request_via_ssl(int *sockfd, ngx_http_link_func_s
24982498
if ( connect(*sockfd, (struct sockaddr *) &dest_addr,
24992499
sizeof(struct sockaddr)) == -1 ) {
25002500
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "Unable connect to host %s - %s on port %d.\n",
2501-
hostname, inet_ntoa(dest_addr.sin_addr), port);
2501+
hostname, inet_ntoa(dest_addr.sin_addr), port);
25022502
rc = 0;
25032503
goto DONE;
25042504
}

0 commit comments

Comments
 (0)