defined id_log() only once

This commit is contained in:
Marc Stern
2024-04-16 13:28:37 +02:00
parent 556835c6fe
commit 5122f89005
4 changed files with 5 additions and 13 deletions

View File

@@ -31,10 +31,9 @@
#endif
// Returns the rule id if existing, otherwise the file name & line number
static const char* id_log(msre_rule* rule) {
const char* id_log(msre_rule* rule) {
char* id = rule->actionset->id;
if (id == NOT_SET_P || !id || !*id)
id = apr_psprintf(rule->ruleset->mp, "%s (%d)", rule->filename, rule->line_num);
if (!id || !*id || id == NOT_SET_P) id = apr_psprintf(rule->ruleset->mp, "%s (%d)", rule->filename, rule->line_num);
return id;
}

View File

@@ -166,6 +166,7 @@ int ip_tree_from_uri(TreeRoot **rtree, char *uri,
#endif
char DSOLOCAL *get_username(apr_pool_t* mp);
const char* id_log(msre_rule* rule);
int read_line(char *buff, int size, FILE *fp);

View File

@@ -48,13 +48,6 @@ static apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr);
/* -- Actions, variables, functions and operator functions ----------------- */
// Returns the rule id if existing, otherwise the file name & line number
static const char* id_log(msre_rule* rule) {
const char* id = rule->actionset->id;
if (!id || !*id || id == NOT_SET_P) id = apr_psprintf(rule->ruleset->mp, "%s (%d)", rule->filename, rule->line_num);
return id;
}
/**
* \brief Remove rule targets to be processed
*