]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: server: move findserver() from proxy.c to server.c
authorWilly Tarreau <w@1wt.eu>
Thu, 10 Jul 2025 08:56:34 +0000 (10:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 15 Jul 2025 08:30:27 +0000 (10:30 +0200)
The reason this function was overlooked is that it had mostly equivalent
ones in server.c, let's move them together.

include/haproxy/proxy.h
include/haproxy/server.h
src/proxy.c
src/server.c

index 8fed1b69e3ac9f9d841f655d852ece09053cf484..4e371241c1b519ff8a99c2ffb6fd84eff5b7496f 100644 (file)
@@ -61,7 +61,6 @@ void proxy_store_name(struct proxy *px);
 struct proxy *proxy_find_by_id(int id, int cap, int table);
 struct proxy *proxy_find_by_name(const char *name, int cap, int table);
 struct proxy *proxy_find_best_match(int cap, const char *name, int id, int *diff);
-struct server *findserver(const struct proxy *px, const char *name);
 int proxy_cfg_ensure_no_http(struct proxy *curproxy);
 int proxy_cfg_ensure_no_log(struct proxy *curproxy);
 void init_new_proxy(struct proxy *p);
index db134f1532b663f04a3e5a0f2145640d384ad71b..e435f9a1f990759b73794605474b9632c88cf94b 100644 (file)
@@ -61,6 +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(const struct proxy *px, const char *name);
 struct server *server_find_by_name(struct proxy *bk, const char *name);
 struct server *server_find_by_name_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 1c1e3722ddc8f8e99500890b6f4c63074a9ee327..24939662f3bcabd6efe3b37d0e71cb28659821f7 100644 (file)
@@ -1377,26 +1377,6 @@ struct proxy *proxy_find_best_match(int cap, const char *name, int id, int *diff
        return NULL;
 }
 
-/*
- * This function returns the server with a matching name within selected proxy,
- * or NULL if not found.
- */
-
-struct server *findserver(const struct proxy *px, const char *name)
-{
-       struct server *cursrv;
-
-       if (!px)
-               return NULL;
-
-       for (cursrv = px->srv; cursrv; cursrv = cursrv->next) {
-               if (strcmp(cursrv->id, name) == 0)
-                       return cursrv;
-       }
-
-       return NULL;
-}
-
 /* This function checks that the designated proxy has no http directives
  * enabled. It will output a warning if there are, and will fix some of them.
  * It returns the number of fatal errors encountered. This should be called
index 232446c6feb64c02bb2a1d69b4fb4efd8a9f10b0..44e7c48586f527cc9843a0022704d64291ad65a7 100644 (file)
@@ -4002,6 +4002,26 @@ struct server *server_find_by_id_unique(struct proxy *bk, int id, uint32_t rid)
        return curserver;
 }
 
+/*
+ * This function returns the server with a matching name within selected proxy,
+ * or NULL if not found.
+ */
+
+struct server *findserver(const struct proxy *px, const char *name)
+{
+       struct server *cursrv;
+
+       if (!px)
+               return NULL;
+
+       for (cursrv = px->srv; cursrv; cursrv = cursrv->next) {
+               if (strcmp(cursrv->id, name) == 0)
+                       return cursrv;
+       }
+
+       return NULL;
+}
+
 /* Returns a pointer to the first server matching either name <name>, or id
  * if <name> starts with a '#'. NULL is returned if no match is found.
  * the lookup is performed in the backend <bk>