Formatting and unbreaking NOHTTP builds.

This commit is contained in:
Joris Vink 2016-02-01 20:02:02 +01:00
parent f4d00645ed
commit 82a9e6ef59
6 changed files with 47 additions and 60 deletions

View File

@ -97,7 +97,7 @@ kore_platform_event_init(void)
void
kore_platform_event_cleanup(void)
{
if (kfd >= 0) {
if (kfd != -1) {
close(kfd);
kfd = -1;
}

View File

@ -47,7 +47,7 @@ kore_domain_cleanup(void)
{
struct kore_domain *dom;
while ((dom=TAILQ_FIRST(&domains)) != NULL) {
while ((dom = TAILQ_FIRST(&domains)) != NULL) {
TAILQ_REMOVE(&domains, dom, list);
kore_domain_free(dom);
}
@ -85,44 +85,41 @@ kore_domain_new(char *domain)
void
kore_domain_free(struct kore_domain *dom)
{
#if !defined(KORE_NO_HTTP)
struct kore_module_handle *hdlr;
#endif
if (dom == NULL)
return;
if (dom != NULL) {
if (primary_dom == dom)
primary_dom = NULL;
if (primary_dom == dom) {
primary_dom = NULL;
}
TAILQ_REMOVE(&domains, dom, list);
TAILQ_REMOVE(&domains, dom, list);
if (dom->domain != NULL) {
kore_mem_free(dom->domain);
}
if (dom->domain != NULL)
kore_mem_free(dom->domain);
#if !defined(KORE_NO_TLS)
if (dom->ssl_ctx != NULL) {
SSL_CTX_free(dom->ssl_ctx);
}
if (dom->cafile != NULL) {
kore_mem_free(dom->cafile);
}
if (dom->certkey != NULL) {
kore_mem_free(dom->certkey);
}
if (dom->certfile != NULL) {
kore_mem_free(dom->certfile);
}
if (dom->crlfile != NULL) {
kore_mem_free(dom->crlfile);
}
if (dom->ssl_ctx != NULL)
SSL_CTX_free(dom->ssl_ctx);
if (dom->cafile != NULL)
kore_mem_free(dom->cafile);
if (dom->certkey != NULL)
kore_mem_free(dom->certkey);
if (dom->certfile != NULL)
kore_mem_free(dom->certfile);
if (dom->crlfile != NULL)
kore_mem_free(dom->crlfile);
#endif
/* Drop all handlers associated with this domain */
while ((hdlr=TAILQ_FIRST(&(dom->handlers))) != NULL) {
TAILQ_REMOVE(&(dom->handlers), hdlr, list);
kore_module_handler_free(hdlr);
}
kore_mem_free(dom);
#if !defined(KORE_NO_HTTP)
/* Drop all handlers associated with this domain */
while ((hdlr = TAILQ_FIRST(&(dom->handlers))) != NULL) {
TAILQ_REMOVE(&(dom->handlers), hdlr, list);
kore_module_handler_free(hdlr);
}
#endif
kore_mem_free(dom);
}
void
@ -233,9 +230,7 @@ kore_domain_sslstart(struct kore_domain *dom)
SSL_CTX_set_tlsext_servername_callback(dom->ssl_ctx, kore_tls_sni_cb);
kore_mem_free(dom->certfile);
dom->certfile = NULL;
kore_mem_free(dom->certkey);
dom->certkey = NULL;
#endif
}

View File

@ -421,7 +421,7 @@ kore_server_start(void)
kore_platform_event_cleanup();
kore_connection_cleanup();
kore_domain_cleanup();
kore_domain_cleanup();
net_cleanup();
}

View File

@ -74,7 +74,7 @@ kore_platform_event_init(void)
void
kore_platform_event_cleanup(void)
{
if (efd >= 0) {
if (efd != -1) {
close(efd);
efd = -1;
}

View File

@ -201,28 +201,25 @@ kore_module_handler_free(struct kore_module_handle *hdlr)
{
struct kore_handler_params *param;
if (hdlr != NULL) {
if (hdlr->func != NULL) {
kore_mem_free(hdlr->func);
}
if (hdlr->path != NULL) {
kore_mem_free(hdlr->path);
}
if (hdlr->dom != NULL) {
TAILQ_REMOVE(&(hdlr->dom->handlers), hdlr, list);
}
if (hdlr == NULL)
return;
if (hdlr->func != NULL)
kore_mem_free(hdlr->func);
if (hdlr->path != NULL)
kore_mem_free(hdlr->path);
if (hdlr->type == HANDLER_TYPE_DYNAMIC)
regfree(&(hdlr->rctx));
/* Drop all validators associated with this handler */
while ((param=TAILQ_FIRST(&(hdlr->params))) != NULL) {
TAILQ_REMOVE(&(hdlr->params), param, list);
if (param->name != NULL) {
kore_mem_free(param->name);
}
kore_mem_free(param);
}
kore_mem_free(hdlr);
/* Drop all validators associated with this handler */
while ((param = TAILQ_FIRST(&(hdlr->params))) != NULL) {
TAILQ_REMOVE(&(hdlr->params), param, list);
if (param->name != NULL)
kore_mem_free(param->name);
kore_mem_free(param);
}
kore_mem_free(hdlr);
}
struct kore_module_handle *

View File

@ -45,11 +45,6 @@ kore_pool_init(struct kore_pool *pool, const char *name,
void
kore_pool_cleanup(struct kore_pool *pool)
{
if (pool->inuse)
kore_debug("Pool %s: destroyed with %u allocs in use",
pool->name ? pool->name : "<unknown>",
pool->inuse );
pool->elms = 0;
pool->inuse = 0;
pool->elen = 0;
@ -137,7 +132,7 @@ pool_region_create(struct kore_pool *pool, u_int32_t elms)
static void
pool_region_destroy(struct kore_pool *pool)
{
struct kore_pool_region *reg;
struct kore_pool_region *reg;
kore_debug("pool_region_destroy(%p)", pool);