upstream: add upstream list parameter to upstream_add()

to abstract it from the concrete list in the config struct.

Michael
This commit is contained in:
Michael Adam committed 2009-12-07 00:22:28 +01:00
1 parent fd987e97f0
commit 22fba83df2
3 files changed
+10 -8

No files matched your search

+5 -4
View File
@@ -119,7 +119,8 @@ fail:
/*
* Add an entry to the upstream list
*/
void upstream_add (const char *host, int port, const char *domain)
void upstream_add (const char *host, int port, const char *domain,
struct upstream **upstream_list)
{
struct upstream *up;
@@ -129,7 +130,7 @@ void upstream_add (const char *host, int port, const char *domain)
}
if (!up->domain && !up->ip) { /* always add default to end */
struct upstream *tmp = config.upstream_list;
struct upstream *tmp = *upstream_list;
while (tmp) {
if (!tmp->domain && !tmp->ip) {
@@ -148,8 +149,8 @@ void upstream_add (const char *host, int port, const char *domain)
}
}
up->next = config.upstream_list;
config.upstream_list = up;
up->next = *upstream_list;
*upstream_list = up;
return;