X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_buffer.c;h=b84bcd0cb37ac247d06b5e7b7591435c02798a67;hp=059db0670e18cab29461c0c12fe7431c0b2692c0;hb=cd3cad9da098f0dae2997dd6a52a907bfaaf6041;hpb=03f11ce599fa5a89148d588caf6ccec7f939e9d4 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;