MINOR: rules: add a new function new_act_rule() to allocate act_rules

Rules are currently allocated using calloc() by their caller, which does
not make it very convenient to pass more information such as the file
name and line number.

This patch introduces new_act_rule() which performs the malloc() and
already takes in argument the ruleset (ACT_F_*), the file name and the
line number. This saves the caller from having to assing ->from, and
will allow to improve the internal storage with more info.
This commit is contained in:
Willy Tarreau
2021-10-11 08:49:26 +02:00
parent e972c0acde
commit d535f807bb
5 changed files with 22 additions and 11 deletions

View File

@@ -111,6 +111,7 @@ static inline void release_timeout_action(struct act_rule *rule)
release_sample_expr(rule->arg.timeout.expr);
}
struct act_rule *new_act_rule(enum act_from from, const char *file, int linenum);
void free_act_rules(struct list *rules);
#endif /* _HAPROXY_ACTION_H */