From: Amaury Denoyelle Date: Thu, 16 Jul 2026 13:07:02 +0000 (+0200) Subject: CLEANUP: proxy/config: clean up after proxies list conversion X-Git-Tag: v3.5-dev4~142 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a68d0758c128007e74a668bf850635c26e5d9e90;p=thirdparty%2Fhaproxy.git CLEANUP: proxy/config: clean up after proxies list conversion All proxies list (main proxies, log forward and sink) have been converted to the doubly linked standard list type. Proxy member is now unneeded, it is thus removed from the structure. This patch also removes obsolete _get_next_proxy() wrapper used during check_config_validity(). --- diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index 7ff9f442b..3d30cc28d 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -427,7 +427,6 @@ struct proxy { void *(*stream_new_from_sc)(struct session *sess, struct stconn *sc, struct buffer *in); /* stream instantiation callback for mux stream connector */ struct conn_src conn_src; /* connection source settings */ enum obj_type *default_target; /* default target to use for accepted streams or NULL */ - struct proxy *next; struct proxy *next_stkt_ref; /* Link to the list of proxies which refer to the same stick-table. */ struct list loggers; /* one per 'log' directive */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 57d4bc54b..9a901d96e 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2258,32 +2258,6 @@ err: return err_code; } -/* Returns the next entry following proxy attached it list. This - * is a wrapper able to work with either a simple singly linked list or a - * doubly linked struct list type. - * - * TODO remove it once all proxies list are unified under the same type - */ -static struct proxy *_get_next_proxy(void *head, struct proxy *cur) -{ - struct proxy *next; - struct list *list = (struct list *)head; - - if (head == &main_proxies || head == &cfg_log_forward || head == &sink_proxies_list) { - next = cur ? - LIST_ELEM(cur->el.n, struct proxy *, el) : - LIST_ELEM(list->n, struct proxy *, el); - - if (&next->el == head) - next = NULL; - } - else { - next = cur ? cur->next : head; - } - - return next; -} - /* * Returns the error code, 0 if OK, or any combination of : * - ERR_ABORT: must abort ASAP @@ -2297,7 +2271,7 @@ int check_config_validity() { int cfgerr = 0, ret; struct proxy *defpx; - void *init_proxies_list = NULL; + struct list *init_proxies_list = NULL; struct stktable *t; struct server *newsrv = NULL; struct mt_list back; @@ -2423,12 +2397,11 @@ int check_config_validity() err_code |= proxy_check_http_errors(defpx); } - curproxy = NULL; /* starting to initialize the main proxies list */ init_proxies_list = &main_proxies; init_proxies_list_stage1: - while ((curproxy = _get_next_proxy(init_proxies_list, curproxy))) { + list_for_each_entry(curproxy, init_proxies_list, el) { proxy_init_per_thr(curproxy); /* Assign automatic UUID if unset except for internal proxies. @@ -2479,7 +2452,6 @@ init_proxies_list_stage1: /* Dynamic proxies IDs will never be lowered than this value. */ dynpx_next_id = next_pxid; - curproxy = NULL; /* * We have just initialized the main proxies list * we must also configure the log-forward proxies list @@ -2525,12 +2497,11 @@ init_proxies_list_stage1: /* perform the final checks before creating tasks */ - curproxy = NULL; /* starting to initialize the main proxies list */ init_proxies_list = &main_proxies; init_proxies_list_stage2: - while ((curproxy = _get_next_proxy(init_proxies_list, curproxy))) { + list_for_each_entry(curproxy, init_proxies_list, el) { struct listener *listener; unsigned int next_id; @@ -2633,6 +2604,7 @@ init_proxies_list_stage2: } curproxy = NULL; + /* * We have just initialized the main proxies list * we must also configure the log-forward proxies list