MEDIUM: stick-table: remove the now duplicate find_stktable() function
Since proxy_tbl_by_name() already does the same job, let's not keep duplicate functions and use this one only.
This commit is contained in:
parent
63d38fda4a
commit
e2dc1fa8ca
|
@ -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> */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue