Browse Source

replace calloc http/parser.c with quick fit approach.

release0.1.5
Georg Hopp 12 years ago
parent
commit
196e51d294
  1. 7
      src/http/parser/parse.c

7
src/http/parser/parse.c

@ -57,8 +57,7 @@ httpParserParse(void * _this, Stream st)
if (NULL != this->incomplete) {
cbufSetData(this->buffer, this->incomplete, this->isize);
free(this->incomplete);
this->incomplete = NULL;
MEM_FREE(this->incomplete);
}
if (0 > (read = cbufRead(this->buffer, st))) {
@ -84,7 +83,7 @@ httpParserParse(void * _this, Stream st)
if (NULL == (line = cbufGetLine(this->buffer, &line_end))) {
if (! cbufIsEmpty(this->buffer)) {
this->isize = this->buffer->bused;
this->incomplete = malloc(this->isize);
this->incomplete = memMalloc(this->isize);
memcpy(this->incomplete,
cbufGetData(this->buffer, this->isize),
this->isize);
@ -110,7 +109,7 @@ httpParserParse(void * _this, Stream st)
if (NULL == (line = cbufGetLine(this->buffer, &line_end))) {
if (! cbufIsEmpty(this->buffer)) {
this->isize = this->buffer->bused;
this->incomplete = malloc(this->isize);
this->incomplete = memMalloc(this->isize);
memcpy(this->incomplete,
cbufGetData(this->buffer, this->isize),
this->isize);

Loading…
Cancel
Save