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

@ -85,45 +85,42 @@ 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) {
if (primary_dom == dom)
primary_dom = NULL;
}
TAILQ_REMOVE(&domains, dom, list);
if (dom->domain != NULL) {
if (dom->domain != NULL)
kore_mem_free(dom->domain);
}
#if !defined(KORE_NO_TLS)
if (dom->ssl_ctx != NULL) {
if (dom->ssl_ctx != NULL)
SSL_CTX_free(dom->ssl_ctx);
}
if (dom->cafile != NULL) {
if (dom->cafile != NULL)
kore_mem_free(dom->cafile);
}
if (dom->certkey != NULL) {
if (dom->certkey != NULL)
kore_mem_free(dom->certkey);
}
if (dom->certfile != NULL) {
if (dom->certfile != NULL)
kore_mem_free(dom->certfile);
}
if (dom->crlfile != NULL) {
if (dom->crlfile != NULL)
kore_mem_free(dom->crlfile);
}
#endif
#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
kore_domain_sslstart(struct kore_domain *dom)
@ -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

@ -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,29 +201,26 @@ kore_module_handler_free(struct kore_module_handle *hdlr)
{
struct kore_handler_params *param;
if (hdlr != NULL) {
if (hdlr->func != NULL) {
if (hdlr == NULL)
return;
if (hdlr->func != NULL)
kore_mem_free(hdlr->func);
}
if (hdlr->path != NULL) {
if (hdlr->path != NULL)
kore_mem_free(hdlr->path);
}
if (hdlr->dom != NULL) {
TAILQ_REMOVE(&(hdlr->dom->handlers), hdlr, list);
}
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) {
if (param->name != NULL)
kore_mem_free(param->name);
}
kore_mem_free(param);
}
kore_mem_free(hdlr);
}
}
struct kore_module_handle *
kore_module_handler_find(const char *domain, const char *path)

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;