Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
static funcs from now on will just return int
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFrench committed May 10, 2017
1 parent a93ab64 commit 5112b6d
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions evhtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4732,15 +4732,25 @@ evhtp_add_vhost(evhtp_t * evhtp, const char * name, evhtp_t * vhost)
return 0;
}

evhtp_t *
evhtp_new(evbase_t * evbase, void * arg)
static int
evhtp__new_(evhtp_t ** out, struct event_base * evbase, void * arg)
{
evhtp_t * htp;

evhtp_assert(evbase != NULL);
if (evhtp_unlikely(out == NULL))
{
return -1;
}

htp = calloc(sizeof(evhtp_t), 1);
evhtp_alloc_assert(htp);
if (evhtp_unlikely(evbase == NULL))
{
return -1;
}

if ((htp = calloc(1, sizeof(evhtp_t))) == NULL)
{
return -1;
}

htp->arg = arg;
htp->evbase = evbase;
Expand All @@ -4755,6 +4765,21 @@ evhtp_new(evbase_t * evbase, void * arg)

evhtp_set_gencb(htp, htp__default_request_cb_, (void *)htp);

*out = htp;

return 0;
}

evhtp_t *
evhtp_new(evbase_t * evbase, void * arg)
{
evhtp_t * htp;

if (evhtp__new_(&htp, evbase, arg) == -1)
{
return NULL;
}

return htp;
}

Expand Down Expand Up @@ -4984,3 +5009,4 @@ evhtp_request_status(evhtp_request_t * r)
{
return htparser_get_status(r->conn->parser);
}

0 comments on commit 5112b6d

Please sign in to comment.