MINOR: proxy: simply ignore duplicates in proxy name lookups

Now that we can't have duplicate proxies with similar capabilities, we
can remove some painful check. The first one is the check that made the
lookup function return NULL when a duplicate is found, as it prevented
it from being used in the config parser to detect duplicates.
This commit is contained in:
Willy Tarreau 2015-05-26 11:35:41 +02:00
parent 9e0bb1013e
commit c739aa85e8

View File

@ -388,14 +388,13 @@ struct proxy *findproxy_mode(const char *name, int mode, int cap) {
return target; return target;
} }
/* Returns a pointer to the proxy matching either name <name>, or id <name> if /* Returns a pointer to the first proxy matching either name <name>, or id
* <name> begins with a '#'. NULL is returned if no match is found, as well as * <name> if <name> begins with a '#'. NULL is returned if no match is found.
* if multiple matches are found (eg: too large capabilities mask). If <table> * If <table> is non-zero, it only considers proxies having a table.
* is non-zero, it only considers proxies having a table.
*/ */
struct proxy *proxy_find_by_name(const char *name, int cap, int table) struct proxy *proxy_find_by_name(const char *name, int cap, int table)
{ {
struct proxy *curproxy, *target = NULL; struct proxy *curproxy;
int pid = -1; int pid = -1;
if (*name == '#') { if (*name == '#') {
@ -415,10 +414,7 @@ struct proxy *proxy_find_by_name(const char *name, int cap, int table)
if (table && !curproxy->table.size) if (table && !curproxy->table.size)
continue; continue;
if (target) return curproxy;
return NULL;
target = curproxy;
} }
} }
else { else {
@ -436,13 +432,10 @@ struct proxy *proxy_find_by_name(const char *name, int cap, int table)
if (table && !curproxy->table.size) if (table && !curproxy->table.size)
continue; continue;
if (target) return curproxy;
}
}
return NULL; return NULL;
target = curproxy;
}
}
return target;
} }
/* /*