History log of /lighttpd1.4/src/buffer.c (Results 1 – 25 of 141)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: lighttpd-1.4.69, lighttpd-1.4.68
# 5e14db43 10-Dec-2022 Glenn Strauss <[email protected]>

[multiple] employ ck_calloc, ck_malloc shared code

employ ck_calloc(), ck_malloc() shared code to slightly reduce code size
(centralize the ck_assert() to check that memory allocation succeeded)


Revision tags: lighttpd-1.4.67, lighttpd-1.4.66
# 10d5786f 18-Jul-2022 Glenn Strauss <[email protected]>

[core] fix buffer_substr_replace() extend (fixes #3160)

This bug affects mod_proxy header rewriting to/from backend
(regression in lighttpd 1.4.60 - lighttpd 1.4.65)

(thx k.trempala)

x-ref:
"Wro

[core] fix buffer_substr_replace() extend (fixes #3160)

This bug affects mod_proxy header rewriting to/from backend
(regression in lighttpd 1.4.60 - lighttpd 1.4.65)

(thx k.trempala)

x-ref:
"Wrong buffer size in function buffer_substr_replace() in file buffer.c"
https://redmine.lighttpd.net/issues/3160

show more ...


# aaf36f58 27-Jun-2022 Glenn Strauss <[email protected]>

[core] perf tweak buffer_eq_icase_ssn()


# 91ce3b08 10-Jun-2022 Glenn Strauss <[email protected]>

[core] buffer_append_bs_escaped_json()

separate func from buffer_append_bs_escaped() so that both
buffer_append_bs_escaped() and buffer_append_bs_escaped_json()
can be slightly more specialized and

[core] buffer_append_bs_escaped_json()

separate func from buffer_append_bs_escaped() so that both
buffer_append_bs_escaped() and buffer_append_bs_escaped_json()
can be slightly more specialized and optimized

show more ...


# ca407dca 10-Jun-2022 Glenn Strauss <[email protected]>

[multiple] fix json encoding

(thx helmut)

fix json encoding to operate on unicode code points


Revision tags: lighttpd-1.4.65
# fc32d4c9 08-May-2022 Glenn Strauss <[email protected]>

[core] buffer_append_string_c_escaped ASCII optim


# d22e88b7 08-May-2022 Glenn Strauss <[email protected]>

[core] buffer_append_bs_escaped()

move accesslog_append_escaped() to buffer_append_bs_escaped()
replace buffer_append_string_encoded_json()


Revision tags: lighttpd-1.4.64
# 51e141c8 07-Jan-2022 Glenn Strauss <[email protected]>

[multiple] remove buffer_init_buffer()

remove (minor) convenience func; easy to replace

Like buffer_init_string(), buffer_init_buffer() was used in only a few
places at startup or in cold funcs, so

[multiple] remove buffer_init_buffer()

remove (minor) convenience func; easy to replace

Like buffer_init_string(), buffer_init_buffer() was used in only a few
places at startup or in cold funcs, so better off removed from buffer.c

show more ...


# bade1c03 07-Jan-2022 Glenn Strauss <[email protected]>

[multiple] remove buffer_init_string()

remove (minor) convenience func; easy to replace


# e174e7df 07-Jan-2022 Glenn Strauss <[email protected]>

[core] buffer_copy_string() use "" if s is NULL

same for buffer_append_string()


Revision tags: lighttpd-1.4.63, lighttpd-1.4.62
# e1ff1cc8 17-Nov-2021 Glenn Strauss <[email protected]>

[core] buffer_append_string_encoded_json()


# 05dc3d12 11-Nov-2021 Glenn Strauss <[email protected]>

[core] better asm for binary num to ascii string

compiler optimizers generally convert div to an equivalent mul,
though not always optimally for modulus (%). In places where
lighttpd is using both

[core] better asm for binary num to ascii string

compiler optimizers generally convert div to an equivalent mul,
though not always optimally for modulus (%). In places where
lighttpd is using both quotient and remainder, calculate the
remainder from the quotient.

x-ref: inspiration:
https://lemire.me/blog/2019/02/08/faster-remainders-when-the-divisor-is-a-constant-beating-compilers-and-libdivide/
https://lemire.me/blog/2019/02/20/more-fun-with-fast-remainders-when-the-divisor-is-a-constant/

show more ...


# 57c0859f 10-Nov-2021 Glenn Strauss <[email protected]>

[core] uint_fast32_t tweaks

use uint_fast32_t in a few more places, where it yields better asm


# c29268cd 30-Oct-2021 Glenn Strauss <[email protected]>

[core] remove redundant asserts

buffer_append_strftime() requires a non-NULL const string for format

buffer_append_string_encoded() and buffer_append_string_c_escaped()
both will handle encoding a

[core] remove redundant asserts

buffer_append_strftime() requires a non-NULL const string for format

buffer_append_string_encoded() and buffer_append_string_c_escaped()
both will handle encoding a 0-length string. Since a 0-length string
is not expected, do not special-case it. C type buffer_encoding_t
expects a constant value to be passed, so encoding map is not NULL.

show more ...


Revision tags: lighttpd-1.4.61
# 07c8a6f0 06-Oct-2021 Glenn Strauss <[email protected]>

[core] bounds check while url-decoding

(thx helmut)

do not read-ahead past '\0' while url-decoding

lighttpd 1.4.60 could previously have read one byte of potentially
uninitialized data. lighttpd

[core] bounds check while url-decoding

(thx helmut)

do not read-ahead past '\0' while url-decoding

lighttpd 1.4.60 could previously have read one byte of potentially
uninitialized data. lighttpd detects the '\0' so there is no exposure
of data. This also can not cause a crash in lighttpd 1.4.60 due to how
lighttpd 1.4.60 allocates memory for buffers in sizes (power-2 + 1),
and typical system malloc alignment of 4- or 8- bytes.

show more ...


# 575665ad 05-Oct-2021 Glenn Strauss <[email protected]>

[multiple] __attribute_nonnull__ now takes params

define __attribute_nonnull__(params) with params to match
recent changes in glibc development (targetting glibc 2.35 in Feb 2022)

x-ref:
new __at

[multiple] __attribute_nonnull__ now takes params

define __attribute_nonnull__(params) with params to match
recent changes in glibc development (targetting glibc 2.35 in Feb 2022)

x-ref:
new __attribute_nonnull__(params) conflicts with third-party
https://sourceware.org/bugzilla/show_bug.cgi?id=28425

show more ...


Revision tags: lighttpd-1.4.60
# a3e9faa4 09-Sep-2021 Glenn Strauss <[email protected]>

[multiple] quiet coverity warnings


# ee9352b1 30-Aug-2021 Glenn Strauss <[email protected]>

[core] realloc buffer power-2 size + 1 for '\0'

realloc buffer power-2 size + 1 for '\0' to avoid power-2 allocation
doubling buffer size for sole reason of storing '\0' at end of block


# e89d7513 18-Jun-2021 Glenn Strauss <[email protected]>

[core] avoid inlining buffer_eq_icase_ssn()

(slightly better asm)


# 1cd73b08 15-Jun-2021 Glenn Strauss <[email protected]>

[core] move backtrace and assert macros to ck.[ch]


# f490078d 15-Jun-2021 Glenn Strauss <[email protected]>

[multiple] buffer_copy_string_len_lc()

convenience wrapper combining
buffer_copy_string_len()
buffer_to_lower()
and making a single pass over string


# 84fa4b8d 14-Jun-2021 Glenn Strauss <[email protected]>

[core] buffer_realloc() using power-2 realloc


# 5beee8b2 13-Jun-2021 Glenn Strauss <[email protected]>

[core] buffer_path_simplify() quick(er) path

scan to detect (potential) need for path simplification
(repeated '/' or "/.") before copying each char in string


# af3df29a 09-Jun-2021 Glenn Strauss <[email protected]>

[multiple] reduce redundant NULL buffer checks

This commit is a large set of code changes and results in removal of
hundreds, perhaps thousands, of CPU instructions, a portion of which
are on hot co

[multiple] reduce redundant NULL buffer checks

This commit is a large set of code changes and results in removal of
hundreds, perhaps thousands, of CPU instructions, a portion of which
are on hot code paths.

Most (buffer *) used by lighttpd are not NULL, especially since buffers
were inlined into numerous larger structs such as request_st and chunk.

In the small number of instances where that is not the case, a NULL
check is often performed earlier in a function where that buffer is
later used with a buffer_* func. In the handful of cases that remained,
a NULL check was added, e.g. with r->http_host and r->conf.server_tag.

- check for empty strings at config time and set value to NULL if blank
string will be ignored at runtime; at runtime, simple pointer check
for NULL can be used to check for a value that has been set and is not
blank ("")
- use buffer_is_blank() instead of buffer_string_is_empty(),
and use buffer_is_unset() instead of buffer_is_empty(),
where buffer is known not to be NULL so that NULL check can be skipped
- use buffer_clen() instead of buffer_string_length() when buffer is
known not to be NULL (to avoid NULL check at runtime)
- use buffer_truncate() instead of buffer_string_set_length() to
truncate string, and use buffer_extend() to extend

Examples where buffer known not to be NULL:
- cpv->v.b from config_plugin_values_init is not NULL if T_CONFIG_BOOL
(though we might set it to NULL if buffer_is_blank(cpv->v.b))
- address of buffer is arg (&foo)
(compiler optimizer detects this in most, but not all, cases)
- buffer is checked for NULL earlier in func
- buffer is accessed in same scope without a NULL check (e.g. b->ptr)

internal behavior change:
callers must not pass a NULL buffer to some funcs.
- buffer_init_buffer() requires non-null args
- buffer_copy_buffer() requires non-null args
- buffer_append_string_buffer() requires non-null args
- buffer_string_space() requires non-null arg

show more ...


# 8b96169b 24-May-2021 Glenn Strauss <[email protected]>

[core] buffer_commit() optim; better asm


123456