diff options
Diffstat (limited to 'src/sp_config.c')
| -rw-r--r-- | src/sp_config.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/sp_config.c b/src/sp_config.c index 5431eca..d29247b 100644 --- a/src/sp_config.c +++ b/src/sp_config.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | static zend_result sp_process_config_root(sp_parsed_keyword *parsed_rule) { | 8 | static zend_result sp_process_config_root(sp_parsed_keyword *parsed_rule) { |
| 9 | sp_config_keyword sp_func[] = { | 9 | static const sp_config_keyword sp_func[] = { |
| 10 | {parse_unserialize, SP_TOKEN_UNSERIALIZE_HMAC, &(SPCFG(unserialize))}, | 10 | {parse_unserialize, SP_TOKEN_UNSERIALIZE_HMAC, &(SPCFG(unserialize))}, |
| 11 | {parse_enable, SP_TOKEN_HARDEN_RANDOM, &(SPCFG(random).enable)}, | 11 | {parse_enable, SP_TOKEN_HARDEN_RANDOM, &(SPCFG(random).enable)}, |
| 12 | {parse_log_media, SP_TOKEN_LOG_MEDIA, &(SPCFG(log_media))}, | 12 | {parse_log_media, SP_TOKEN_LOG_MEDIA, &(SPCFG(log_media))}, |
| @@ -29,7 +29,7 @@ static zend_result sp_process_config_root(sp_parsed_keyword *parsed_rule) { | |||
| 29 | return sp_process_rule(parsed_rule, sp_func); | 29 | return sp_process_rule(parsed_rule, sp_func); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | zend_result sp_parse_config(const char *filename) { | 32 | zend_result sp_parse_config(const char *const filename) { |
| 33 | FILE *fd = fopen(filename, "rb"); | 33 | FILE *fd = fopen(filename, "rb"); |
| 34 | if (fd == NULL) { | 34 | if (fd == NULL) { |
| 35 | sp_log_err("config", "Could not open configuration file %s : %s", filename, strerror(errno)); | 35 | sp_log_err("config", "Could not open configuration file %s : %s", filename, strerror(errno)); |
| @@ -65,7 +65,7 @@ zend_result sp_parse_config(const char *filename) { | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | zend_result sp_process_rule(sp_parsed_keyword *parsed_rule, const sp_config_keyword *config_keywords) { | 68 | zend_result sp_process_rule(sp_parsed_keyword *parsed_rule, const sp_config_keyword *const config_keywords) { |
| 69 | for (sp_parsed_keyword *kw = parsed_rule; kw->kw; kw++) { | 69 | for (sp_parsed_keyword *kw = parsed_rule; kw->kw; kw++) { |
| 70 | bool found_kw = false; | 70 | bool found_kw = false; |
| 71 | for (const sp_config_keyword *ckw = config_keywords; ckw->func; ckw++) { | 71 | for (const sp_config_keyword *ckw = config_keywords; ckw->func; ckw++) { |
| @@ -119,13 +119,12 @@ SP_PARSEKW_FN(parse_list) { | |||
| 119 | CHECK_DUPLICATE_KEYWORD(retval); | 119 | CHECK_DUPLICATE_KEYWORD(retval); |
| 120 | 120 | ||
| 121 | sp_list_node **list = retval; | 121 | sp_list_node **list = retval; |
| 122 | char *tok, *tmp; | ||
| 123 | 122 | ||
| 124 | SP_PARSE_ARG(value); | 123 | SP_PARSE_ARG(value); |
| 125 | 124 | ||
| 126 | tmp = ZSTR_VAL(value); | 125 | char* tmp = ZSTR_VAL(value); |
| 127 | while (1) { | 126 | while (1) { |
| 128 | tok = strsep(&tmp, ","); | 127 | const char* const tok = strsep(&tmp, ","); |
| 129 | if (tok == NULL) { | 128 | if (tok == NULL) { |
| 130 | break; | 129 | break; |
| 131 | } | 130 | } |
