From 9f5e8d12f05fb24c915a5266a1e908a75c8aed08 Mon Sep 17 00:00:00 2001 From: Thibault "bui" Koechlin Date: Thu, 28 Dec 2017 17:04:06 +0100 Subject: Clang-format pass - `clang-format --style="{BasedOnStyle: google, SortIncludes: false}" -i snuffleu*.c sp_*.c sp_*.h` - Update the documentation accordingly--- src/sp_config_keywords.c | 66 +++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'src/sp_config_keywords.c') diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index b3e71fe..998b692 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c @@ -108,12 +108,12 @@ int parse_cookie(char *line) { sp_cookie *cookie = pecalloc(sizeof(sp_cookie), 1, 1); sp_config_functions sp_config_funcs_cookie_encryption[] = { - {parse_str, SP_TOKEN_NAME, &(cookie->name)}, - {parse_regexp, SP_TOKEN_NAME_REGEXP, &(cookie->name_r)}, - {parse_str, SP_TOKEN_SAMESITE, &samesite}, - {parse_empty, SP_TOKEN_ENCRYPT, &cookie->encrypt}, - {parse_empty, SP_TOKEN_SIMULATION, &cookie->simulation}, - {0}}; + {parse_str, SP_TOKEN_NAME, &(cookie->name)}, + {parse_regexp, SP_TOKEN_NAME_REGEXP, &(cookie->name_r)}, + {parse_str, SP_TOKEN_SAMESITE, &samesite}, + {parse_empty, SP_TOKEN_ENCRYPT, &cookie->encrypt}, + {parse_empty, SP_TOKEN_SIMULATION, &cookie->simulation}, + {0}}; ret = parse_keywords(sp_config_funcs_cookie_encryption, line); if (0 != ret) { @@ -122,18 +122,21 @@ int parse_cookie(char *line) { if (cookie->encrypt) { if (0 == (SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)) { - sp_log_err("config", - "You're trying to use the cookie encryption feature" - "on line %zu without having set the `.cookie_env_var` option in" - "`sp.global`: please set it first.", + sp_log_err( + "config", + "You're trying to use the cookie encryption feature" + "on line %zu without having set the `.cookie_env_var` option in" + "`sp.global`: please set it first.", sp_line_no); return -1; - } else if (0 == (SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key)) { - sp_log_err("config", - "You're trying to use the cookie encryption feature" - "on line %zu without having set the `.encryption_key` option in" - "`sp.global`: please set it first.", - sp_line_no); + } else if (0 == + (SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key)) { + sp_log_err( + "config", + "You're trying to use the cookie encryption feature" + "on line %zu without having set the `.encryption_key` option in" + "`sp.global`: please set it first.", + sp_line_no); return -1; } } else if (!samesite) { @@ -163,16 +166,16 @@ int parse_cookie(char *line) { } else if (0 == strcasecmp(samesite, SP_TOKEN_SAMESITE_STRICT)) { cookie->samesite = strict; } else { - sp_log_err("config", - "%s is an invalid value to samesite (expected %s or %s) on line " - "%zu.", - samesite, SP_TOKEN_SAMESITE_LAX, SP_TOKEN_SAMESITE_STRICT, - sp_line_no); + sp_log_err( + "config", + "%s is an invalid value to samesite (expected %s or %s) on line " + "%zu.", + samesite, SP_TOKEN_SAMESITE_LAX, SP_TOKEN_SAMESITE_STRICT, + sp_line_no); return -1; } } - sp_list_insert(SNUFFLEUPAGUS_G(config).config_cookie->cookies, - cookie); + sp_list_insert(SNUFFLEUPAGUS_G(config).config_cookie->cookies, cookie); return SUCCESS; } @@ -235,8 +238,8 @@ int parse_disabled_functions(char *line) { MUTUALLY_EXCLUSIVE(df->key, df->r_key, "r_key", "key"); #undef MUTUALLY_EXCLUSIVE - if (1 < ((df->r_param ? 1 : 0) + (param ? 1 : 0) + - ((-1 != df->pos) ? 1 : 0))) { + if (1 < + ((df->r_param ? 1 : 0) + (param ? 1 : 0) + ((-1 != df->pos) ? 1 : 0))) { sp_log_err( "config", "Invalid configuration line: 'sp.disabled_functions%s':" @@ -306,8 +309,8 @@ int parse_disabled_functions(char *line) { if (param) { df->param = parse_var(param); if (!df->param) { - sp_log_err("config", "Invalid value '%s' for `param` on line %zu.", - param, sp_line_no); + sp_log_err("config", "Invalid value '%s' for `param` on line %zu.", param, + sp_line_no); return -1; } } @@ -316,13 +319,12 @@ int parse_disabled_functions(char *line) { if (*var) { df->var = parse_var(var); if (!df->var) { - sp_log_err("config", "Invalid value '%s' for `var` on line %zu.", - var, sp_line_no); - return -1; + sp_log_err("config", "Invalid value '%s' for `var` on line %zu.", var, + sp_line_no); + return -1; } } else { - sp_log_err("config", "Empty value in `var` on line %zu.", - sp_line_no); + sp_log_err("config", "Empty value in `var` on line %zu.", sp_line_no); return -1; } } -- cgit v1.3