Skip to content

Instantly share code, notes, and snippets.

@dstufft
Last active August 29, 2015 14:04
Show Gist options
  • Save dstufft/eeb31c1075c87c1521f8 to your computer and use it in GitHub Desktop.
Save dstufft/eeb31c1075c87c1521f8 to your computer and use it in GitHub Desktop.
HTTPParser *HTTPParser_create() {
HTTPParser *parser = malloc(sizeof(*parser));
if (!parser) {
return NULL;
}
parser->state = malloc(sizeof *parser->state);
if (!parser->state) {
HTTPParser_destroy(parser);
return NULL;
}
return parser;
}
void HTTPParser_destroy(HTTPParser *parser) {
free(parser->state);
free(parser);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment