X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_buffer.c;h=b84bcd0cb37ac247d06b5e7b7591435c02798a67;hp=059db0670e18cab29461c0c12fe7431c0b2692c0;hb=be9585b914061f84c5d5939673d29ecc048ab1d7;hpb=e22fc5f78e8cfc1101c4548de0568add46a8694a diff --git a/php_http_buffer.c b/php_http_buffer.c index 059db06..b84bcd0 100644 --- a/php_http_buffer.c +++ b/php_http_buffer.c @@ -50,7 +50,7 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex( { char *ptr = NULL; #if 0 - fprintf(stderr, "RESIZE: len=%lu, size=%lu, used=%lu, free=%lu\n", len, buf->size, buf->used, buf->free); + fprintf(stderr, "RESIZE: len=%lu, size=%lu, used=%lu, free=%lu, total=%lu\n", len, buf->size, buf->used, buf->free, buf->free+buf->used); #endif if (buf->free < len) { size_t size = override_size ? override_size : buf->size; @@ -81,10 +81,7 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex( PHP_HTTP_BUFFER_API char *php_http_buffer_account( php_http_buffer_t *buf, size_t to_account) { - /* it's probably already too late but check anyway */ - if (to_account > buf->free) { - return NULL; - } + assert(to_account <= buf->free); buf->free -= to_account; buf->used += to_account;