commit fc9cc497e075cf321fe0dcf4c6783e2eeb8b9d43 from: Omar Polo date: Thu Jun 08 15:59:53 2023 UTC move some new_* functions from parse.y to utils.c commit - e69e1151f696b01d1fe80570901d21bc78ed5ab1 commit + fc9cc497e075cf321fe0dcf4c6783e2eeb8b9d43 blob - 8fd974f497de4aec8f8b8b20887b70c3b81b5c67 blob + af95f1b2e793727cbde35013f946042c7ff4da92 --- gmid.h +++ gmid.h @@ -340,9 +340,6 @@ void yyerror(const char*, ...); void parse_conf(const char*); void print_conf(void); int cmdline_symset(char *); -struct vhost *new_vhost(void); -struct location *new_location(void); -struct proxy *new_proxy(void); /* mime.c */ void init_mime(struct mime*); @@ -421,5 +418,8 @@ void *xcalloc(size_t, size_t); void gen_certificate(const char*, const char*, const char*); X509_STORE *load_ca(const char*); int validate_against_ca(X509_STORE*, const uint8_t*, size_t); +struct vhost *new_vhost(void); +struct location *new_location(void); +struct proxy *new_proxy(void); #endif blob - d3de71023238e55fdb4a662a64daa878ec784ce2 blob + 2fb53f27266748a436325782462eafe7264751c6 --- parse.y +++ parse.y @@ -1033,42 +1033,8 @@ symget(const char *nam) } } return NULL; -} - -struct vhost * -new_vhost(void) -{ - struct vhost *h; - - h = xcalloc(1, sizeof(*h)); - TAILQ_INIT(&h->locations); - TAILQ_INIT(&h->params); - TAILQ_INIT(&h->aliases); - TAILQ_INIT(&h->proxies); - return h; -} - -struct location * -new_location(void) -{ - struct location *l; - - l = xcalloc(1, sizeof(*l)); - l->dirfd = -1; - l->fcgi = -1; - return l; } -struct proxy * -new_proxy(void) -{ - struct proxy *p; - - p = xcalloc(1, sizeof(*p)); - p->protocols = TLS_PROTOCOLS_DEFAULT; - return p; -} - char * ensure_absolute_path(char *path) { blob - ff69a359aa07b29e06b289aead0a7c1a4e75f3e9 blob + 794f896e7a5dbeb7651fe5e8f14733350d42b091 --- utils.c +++ utils.c @@ -240,4 +240,38 @@ end: if (ctx != NULL) X509_STORE_CTX_free(ctx); return ret; +} + +struct vhost * +new_vhost(void) +{ + struct vhost *h; + + h = xcalloc(1, sizeof(*h)); + TAILQ_INIT(&h->locations); + TAILQ_INIT(&h->params); + TAILQ_INIT(&h->aliases); + TAILQ_INIT(&h->proxies); + return h; +} + +struct location * +new_location(void) +{ + struct location *l; + + l = xcalloc(1, sizeof(*l)); + l->dirfd = -1; + l->fcgi = -1; + return l; } + +struct proxy * +new_proxy(void) +{ + struct proxy *p; + + p = xcalloc(1, sizeof(*p)); + p->protocols = TLS_PROTOCOLS_DEFAULT; + return p; +}