]> git.ipfire.org Git - thirdparty/haproxy.git/commit
REORG: proxy: centralize the proxy allocation code into alloc_new_proxy()
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Feb 2021 07:49:47 +0000 (08:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Feb 2021 15:23:46 +0000 (16:23 +0100)
commit7683893c70a4dfee4fce8c61641aeafd6fee628e
tree8694205c94e66de51a2a5e63655675f094e1a6d3
parent144289b4596657dc3cd73d82a909ac8c1dcc578d
REORG: proxy: centralize the proxy allocation code into alloc_new_proxy()

This new function takes over the old open-coding that used to be done
for too long in cfg_parse_listen() and it now does everything at once
in a proxy-centric function. The function does all the job of allocating
the structure, initializing it, presetting its defaults from the default
proxy and checking for errors. The code was almost unchanged except for
defproxy being passed as a pointer, and the error message being passed
using memprintf().

This change will be needed to ease reuse of multiple default proxies,
or to create dynamic backends in a distant future.
include/haproxy/proxy.h
src/cfgparse-listen.c
src/proxy.c