MINOR: proxy: add free_server_rules() helper function
Take the px->server_rules freeing part out of free_proxy() and make it a dedicated helper function so that it becomes possible to use it from anywhere.
This commit is contained in:
parent
481e9317e3
commit
f2629ebd4e
|
@ -87,6 +87,7 @@ struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg);
|
||||||
struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg);
|
struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg);
|
||||||
int resolve_stick_rule(struct proxy *curproxy, struct sticking_rule *mrule);
|
int resolve_stick_rule(struct proxy *curproxy, struct sticking_rule *mrule);
|
||||||
void free_stick_rules(struct list *rules);
|
void free_stick_rules(struct list *rules);
|
||||||
|
void free_server_rules(struct list *srules);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function returns a string containing the type of the proxy in a format
|
* This function returns a string containing the type of the proxy in a format
|
||||||
|
|
22
src/proxy.c
22
src/proxy.c
|
@ -189,6 +189,19 @@ static void free_logformat_list(struct list *lfs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_server_rules(struct list *srules)
|
||||||
|
{
|
||||||
|
struct server_rule *srule, *sruleb;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(srule, sruleb, srules, list) {
|
||||||
|
LIST_DELETE(&srule->list);
|
||||||
|
free_acl_cond(srule->cond);
|
||||||
|
free_logformat_list(&srule->expr);
|
||||||
|
free(srule->file);
|
||||||
|
free(srule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void free_proxy(struct proxy *p)
|
void free_proxy(struct proxy *p)
|
||||||
{
|
{
|
||||||
struct server *s;
|
struct server *s;
|
||||||
|
@ -197,7 +210,6 @@ void free_proxy(struct proxy *p)
|
||||||
struct bind_conf *bind_conf, *bind_back;
|
struct bind_conf *bind_conf, *bind_back;
|
||||||
struct acl_cond *cond, *condb;
|
struct acl_cond *cond, *condb;
|
||||||
struct acl *acl, *aclb;
|
struct acl *acl, *aclb;
|
||||||
struct server_rule *srule, *sruleb;
|
|
||||||
struct switching_rule *rule, *ruleb;
|
struct switching_rule *rule, *ruleb;
|
||||||
struct redirect_rule *rdr, *rdrb;
|
struct redirect_rule *rdr, *rdrb;
|
||||||
struct logger *log, *logb;
|
struct logger *log, *logb;
|
||||||
|
@ -260,13 +272,7 @@ void free_proxy(struct proxy *p)
|
||||||
free(acl);
|
free(acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each_entry_safe(srule, sruleb, &p->server_rules, list) {
|
free_server_rules(&p->server_rules);
|
||||||
LIST_DELETE(&srule->list);
|
|
||||||
free_acl_cond(srule->cond);
|
|
||||||
free_logformat_list(&srule->expr);
|
|
||||||
free(srule->file);
|
|
||||||
free(srule);
|
|
||||||
}
|
|
||||||
|
|
||||||
list_for_each_entry_safe(rule, ruleb, &p->switching_rules, list) {
|
list_for_each_entry_safe(rule, ruleb, &p->switching_rules, list) {
|
||||||
LIST_DELETE(&rule->list);
|
LIST_DELETE(&rule->list);
|
||||||
|
|
Loading…
Reference in New Issue