]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: server: rename findserver() to server_find_by_name()
authorWilly Tarreau <w@1wt.eu>
Thu, 10 Jul 2025 09:07:51 +0000 (11:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 15 Jul 2025 08:30:28 +0000 (10:30 +0200)
Now it's more logical and matches what is done in the rest of these
functions. server_find() now relies on it.

include/haproxy/server.h
src/cfgparse.c
src/hlua.c
src/sample.c
src/server.c
src/stats-html.c
src/stream.c

index 38909a484045b857c0ca91932d21697cfbcd7fb3..50768e79f41dc063a0c41f10170453e48623dd2c 100644 (file)
@@ -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);
index ac505300ac830b461889dfccce80b0bcfbb2276f..994a2d2b58090b031357f0e7b069121b0b05a09e 100644 (file)
@@ -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) {
index 48acc0b79a19918ccc4ec3c6cc0b86cb9ea11060..e5f71c51d10a396d0b37be395a66a44732ae98ef 100644 (file)
@@ -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;
index 77c2977cfa37cdcc5618a315d4278341d85ab730..eabecc3221b57427a62f0a2eeddd877b9e55d222 100644 (file)
@@ -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,
index 1505d902c85becdb4ae619db9d59a981b8cd92d6..b924b31364a500d14090c2b473cd04dd7f8b73ec 100644 (file)
@@ -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);
index 55855083e42ab0a14d70073d63a97e57f9b6100d..045af08577051ff42a4ee8591af2b05533e8ca4c 100644 (file)
@@ -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:
index 7123b9cdc83179880a70b746c163704cee190244..f6e32a50fc94daba83d3d60bd8c1389ee688ba5a 100644 (file)
@@ -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;
                        }