From: Willy Tarreau Date: Thu, 10 Jul 2025 09:07:51 +0000 (+0200) Subject: CLEANUP: server: rename findserver() to server_find_by_name() X-Git-Tag: v3.3-dev4~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61acd15ea87dffc8d73ff7f8ac0863b86da85089;p=thirdparty%2Fhaproxy.git CLEANUP: server: rename findserver() to server_find_by_name() Now it's more logical and matches what is done in the rest of these functions. server_find() now relies on it. --- diff --git a/include/haproxy/server.h b/include/haproxy/server.h index 38909a484..50768e79f 100644 --- a/include/haproxy/server.h +++ b/include/haproxy/server.h @@ -61,7 +61,7 @@ const char *srv_update_check_addr_port(struct server *s, const char *addr, const const char *srv_update_agent_addr_port(struct server *s, const char *addr, const char *port); struct server *server_find_by_id(struct proxy *bk, int id); struct server *server_find_by_id_unique(struct proxy *bk, int id, uint32_t rid); -struct server *findserver(struct proxy *px, const char *name); +struct server *server_find_by_name(struct proxy *px, const char *name); struct server *server_find(struct proxy *bk, const char *name); struct server *server_find_unique(struct proxy *bk, const char *name, uint32_t rid); struct server *server_find_best_match(struct proxy *bk, char *name, int id, int *diff); diff --git a/src/cfgparse.c b/src/cfgparse.c index ac505300a..994a2d2b5 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -3313,7 +3313,7 @@ init_proxies_list_stage1: srule->dynamic = 0; srule->srv.name = server_name; - target = findserver(curproxy, srule->srv.name); + target = server_find_by_name(curproxy, srule->srv.name); err_code |= warnif_tcp_http_cond(curproxy, srule->cond); if (!target) { diff --git a/src/hlua.c b/src/hlua.c index 48acc0b79..e5f71c51d 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -1440,7 +1440,7 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp, sname = argp[idx].data.str.area; px = p; } - argp[idx].data.srv = findserver(px, sname); + argp[idx].data.srv = server_find_by_name(px, sname); if (!argp[idx].data.srv) { msg = "server doesn't exist"; goto error; diff --git a/src/sample.c b/src/sample.c index 77c2977cf..eabecc322 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1498,7 +1498,7 @@ int smp_resolve_args(struct proxy *p, char **err) sname = arg->data.str.area; } - srv = findserver(px, sname); + srv = server_find_by_name(px, sname); if (!srv) { memprintf(err, "%sparsing [%s:%d]: unable to find server '%s' in proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", *err ? *err : "", cur->file, cur->line, sname, pname, diff --git a/src/server.c b/src/server.c index 1505d902c..b924b3136 100644 --- a/src/server.c +++ b/src/server.c @@ -4006,7 +4006,7 @@ struct server *server_find_by_id_unique(struct proxy *bk, int id, uint32_t rid) * This function returns the server with a matching name within selected proxy, * or NULL if not found. */ -struct server *findserver(struct proxy *px, const char *name) +struct server *server_find_by_name(struct proxy *px, const char *name) { struct ebpt_node *node; struct server *cursrv; @@ -6553,7 +6553,7 @@ int srv_apply_track(struct server *srv, struct proxy *curproxy) px = curproxy; } - strack = findserver(px, sname); + strack = server_find_by_name(px, sname); if (!strack) { ha_alert("unable to find required server '%s' for tracking.\n", sname); diff --git a/src/stats-html.c b/src/stats-html.c index 55855083e..045af0857 100644 --- a/src/stats-html.c +++ b/src/stats-html.c @@ -1791,7 +1791,7 @@ static int stats_process_http_post(struct stconn *sc) } reprocess = 1; } - else if ((sv = findserver(px, value)) != NULL) { + else if ((sv = server_find_by_name(px, value)) != NULL) { HA_SPIN_LOCK(SERVER_LOCK, &sv->lock); switch (action) { case ST_ADM_ACTION_DISABLE: diff --git a/src/stream.c b/src/stream.c index 7123b9cdc..f6e32a50f 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1220,7 +1220,7 @@ static int process_server_rules(struct stream *s, struct channel *req, int an_bi if (!build_logline(s, tmp->area, tmp->size, &rule->expr)) break; - srv = findserver(s->be, tmp->area); + srv = server_find_by_name(s->be, tmp->area); if (!srv) break; }