diff options
Diffstat (limited to 'data/lighttpd/lighttpd-1.4.53/src/http_vhostdb.c')
-rw-r--r-- | data/lighttpd/lighttpd-1.4.53/src/http_vhostdb.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/data/lighttpd/lighttpd-1.4.53/src/http_vhostdb.c b/data/lighttpd/lighttpd-1.4.53/src/http_vhostdb.c new file mode 100644 index 000000000..db8871ce3 --- /dev/null +++ b/data/lighttpd/lighttpd-1.4.53/src/http_vhostdb.c @@ -0,0 +1,35 @@ +#include "first.h" + +#include "http_vhostdb.h" + +#include <string.h> + + +static http_vhostdb_backend_t http_vhostdb_backends[8]; + +void http_vhostdb_dumbdata_reset (void) +{ + memset(http_vhostdb_backends, 0, sizeof(http_vhostdb_backends)); +} + +const http_vhostdb_backend_t * http_vhostdb_backend_get (const buffer *name) +{ + int i = 0; + while (NULL != http_vhostdb_backends[i].name + && 0 != strcmp(http_vhostdb_backends[i].name, name->ptr)) { + ++i; + } + return (NULL != http_vhostdb_backends[i].name) + ? http_vhostdb_backends+i + : NULL; +} + +void http_vhostdb_backend_set (const http_vhostdb_backend_t *backend) +{ + unsigned int i = 0; + while (NULL != http_vhostdb_backends[i].name) ++i; + /*(must resize http_vhostdb_backends[] if too many different backends)*/ + force_assert( + i < (sizeof(http_vhostdb_backends)/sizeof(http_vhostdb_backend_t))-1); + memcpy(http_vhostdb_backends+i, backend, sizeof(http_vhostdb_backend_t)); +} |