diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2018-11-23 00:37:38 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2018-11-23 00:37:38 -0500 |
commit | f69bd9cdb89f7288c982fafe550cc8f1297d08ca (patch) | |
tree | ea66c7a21cda103eb6b34c6672df8957a8c371c8 /src/http_chunk.c | |
parent | 9749503b1dc221aed4ba6e215c6acb893d8281be (diff) | |
download | lighttpd-git-f69bd9cdb89f7288c982fafe550cc8f1297d08ca.tar.gz |
[core] perf: simple, quick buffer_clear()
quickly clear buffer instead of buffer_string_set_length(b, 0) or
buffer_reset(b). Avoids free() of large buffers about to be reused,
or buffers that are module-scoped, persistent, and reused.
(buffer_reset() should still be used with buffers in connection *con
when the data in the buffers is supplied by external, untrusted source)
Diffstat (limited to 'src/http_chunk.c')
-rw-r--r-- | src/http_chunk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/http_chunk.c b/src/http_chunk.c index 3c620773..1bdf2fa8 100644 --- a/src/http_chunk.c +++ b/src/http_chunk.c @@ -23,7 +23,7 @@ #include <string.h> static buffer * http_chunk_header(buffer *b, uintmax_t len) { - buffer_string_set_length(b, 0); + buffer_clear(b); buffer_append_uint_hex(b, len); buffer_append_string_len(b, CONST_STR_LEN("\r\n")); return b; |