]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stick-table: remove the now duplicate find_stktable() function
authorWilly Tarreau <w@1wt.eu>
Tue, 26 May 2015 10:08:07 +0000 (12:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 26 May 2015 10:08:07 +0000 (12:08 +0200)
Since proxy_tbl_by_name() already does the same job, let's not keep
duplicate functions and use this one only.

include/proto/stick_table.h
src/cfgparse.c
src/dumpstats.c
src/hlua.c
src/sample.c
src/stick_table.c

index de9fd52ead4fe874524b8a323711497d6105eb1d..8c97f733dd0b0736c106147159f4571be495cacc 100644 (file)
@@ -53,7 +53,6 @@ struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, st
 int stktable_compatible_sample(struct sample_expr *expr, unsigned long table_type);
 int stktable_register_data_store(int idx, const char *name, int std_type, int arg_type);
 int stktable_get_data_type(char *name);
-struct proxy *find_stktable(const char *name);
 int stktable_trash_oldest(struct stktable *t, int to_batch);
 
 /* return allocation size for standard data type <type> */
index 778edf74c0e0da5957cd7b90402441b68d42a94c..1de7a1f3a0dc178bcb433e4e719f97e362de5d15 100644 (file)
@@ -3461,7 +3461,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                int myidx = 1;
                struct proxy *other;
 
-               other = find_stktable(curproxy->id);
+               other = proxy_tbl_by_name(curproxy->id);
                if (other) {
                        Alert("parsing [%s:%d] : stick-table name '%s' conflicts with table declared in %s '%s' at %s:%d.\n",
                              file, linenum, curproxy->id, proxy_type_str(other), other->id, other->conf.file, other->conf.line);
index 559f229652c43036a646c7d953f33955bedadfc9..3f5c069460edd70cda361fca385187955c32f58c 100644 (file)
@@ -866,7 +866,7 @@ static void stats_sock_table_request(struct stream_interface *si, char **args, i
        appctx->st0 = action;
 
        if (*args[2]) {
-               appctx->ctx.table.target = find_stktable(args[2]);
+               appctx->ctx.table.target = proxy_tbl_by_name(args[2]);
                if (!appctx->ctx.table.target) {
                        appctx->ctx.cli.msg = "No such table\n";
                        appctx->st0 = STAT_CLI_PRINT;
index 5e1bdc3227518eb366c7bae8f532e5307cbaf421..eec37fa01f54317574967684af85268fcb07b63f 100644 (file)
@@ -654,7 +654,7 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
                                WILL_LJMP(luaL_argerror(L, first + idx, "string expected"));
                        memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
                        trash.str[argp[idx].data.str.len] = 0;
-                       argp[idx].data.prx = find_stktable(trash.str);
+                       argp[idx].data.prx = proxy_tbl_by_name(trash.str);
                        if (!argp[idx].data.prx)
                                WILL_LJMP(luaL_argerror(L, first + idx, "table doesn't exist"));
                        argp[idx].type = ARGT_TAB;
index 3ad2d208103cbb5cd053a7fc7ae331e74377c597..47d48c8ba9e526bc1f605b3f2d5b1b61e2d07e01 100644 (file)
@@ -1214,7 +1214,7 @@ int smp_resolve_args(struct proxy *p)
                case ARGT_TAB:
                        if (arg->data.str.len) {
                                pname = arg->data.str.str;
-                               px = find_stktable(pname);
+                               px = proxy_tbl_by_name(pname);
                        }
 
                        if (!px) {
index 19d6af192319941f7f2e549e85c865e188a28a6d..b68772c081ae7d40c5c01091dc0758630d6dba6b 100644 (file)
@@ -784,24 +784,6 @@ int stktable_get_data_type(char *name)
        return -1;
 }
 
-/* Returns pointer to proxy containing table <name> or NULL if not found */
-struct proxy *find_stktable(const char *name)
-{
-       struct proxy *px;
-       struct ebpt_node *node;
-
-       for (node = ebis_lookup(&proxy_by_name, name); node; node = ebpt_next(node)) {
-               px = container_of(node, struct proxy, conf.by_name);
-
-               if (strcmp(px->id, name) != 0)
-                       break;
-
-               if (px->table.size)
-                       return px;
-       }
-       return NULL;
-}
-
 /* Casts sample <smp> to the type of the table specified in arg(0), and looks
  * it up into this table. Returns true if found, false otherwise. The input
  * type is STR so that input samples are converted to string (since all types