projects
/
m6w6
/
ext-http
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
98d8a1d
)
- improve inflate performance
author
Michael Wallner
<mike@php.net>
Sat, 27 May 2006 22:33:50 +0000
(22:33 +0000)
committer
Michael Wallner
<mike@php.net>
Sat, 27 May 2006 22:33:50 +0000
(22:33 +0000)
http_encoding_api.c
patch
|
blob
|
history
diff --git
a/http_encoding_api.c
b/http_encoding_api.c
index 28f6a9d0daf3d82003baf9997cca67bad159bf51..959031d0bcf47b6631a89ffd50cae2ca2f9a09f6 100644
(file)
--- a/
http_encoding_api.c
+++ b/
http_encoding_api.c
@@
-238,24
+238,21
@@
static inline int http_inflate_rounds(z_stream *Z, int flush, char **buf, size_t
if (PHPSTR_NOMEM == phpstr_resize_ex(&buffer, buffer.size, 0, 1)) {
status = Z_MEM_ERROR;
} else {
if (PHPSTR_NOMEM == phpstr_resize_ex(&buffer, buffer.size, 0, 1)) {
status = Z_MEM_ERROR;
} else {
- do {
- Z->avail_out = buffer.free;
- Z->next_out = (Bytef *) buffer.data + buffer.used;
+ Z->avail_out = buffer.free;
+ Z->next_out = (Bytef *) buffer.data + buffer.used;
#if 0
#if 0
-
fprintf(stderr, "PRIOR: size=%lu, avail=%lu, used=%lu, (%d/%d)\n", buffer.size, Z->avail_out, buffer.used, status, round
);
+
fprintf(stderr, "\n%3d: %3d PRIOR: size=%7lu,\tfree=%7lu,\tused=%7lu,\tavail_in=%7lu,\tavail_out=%7lu\n", round, status, buffer.size, buffer.free, buffer.used, Z->avail_in, Z->avail_out
);
#endif
#endif
-
status = inflate(Z, flush);
+ status = inflate(Z, flush);
-
buffer.used += buffer.free - Z->avail_out;
-
buffer.free = Z->avail_out;
+ buffer.used += buffer.free - Z->avail_out;
+ buffer.free = Z->avail_out;
#if 0
#if 0
-
fprintf(stderr, "AFTER: size=%lu, avail=%lu, used=%lu, (%d/%d)\n", buffer.size, Z->avail_out, buffer.used, status, round
);
+
fprintf(stderr, "%3d: %3d AFTER: size=%7lu,\tfree=%7lu,\tused=%7lu,\tavail_in=%7lu,\tavail_out=%7lu\n", round, status, buffer.size, buffer.free, buffer.used, Z->avail_in, Z->avail_out
);
#endif
#endif
- } while (Z_OK == status && Z->avail_in);
-
HTTP_INFLATE_BUFFER_SIZE_ALIGN(buffer.size);
}
HTTP_INFLATE_BUFFER_SIZE_ALIGN(buffer.size);
}
- } while (
Z_BUF_ERROR == status
&& ++round < HTTP_INFLATE_ROUNDS);
+ } while (
(Z_BUF_ERROR == status || (Z_OK == status && Z->avail_in))
&& ++round < HTTP_INFLATE_ROUNDS);
if (status == Z_OK || status == Z_STREAM_END) {
phpstr_shrink(&buffer);
if (status == Z_OK || status == Z_STREAM_END) {
phpstr_shrink(&buffer);