Last active
August 29, 2015 14:04
-
-
Save dstufft/eeb31c1075c87c1521f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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