diff options
| author | René Scharfe <l.s.r@web.de> | 2026-05-12 13:56:00 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-05-13 00:48:42 +0900 |
| commit | cdeef283bcf8529fc858cfe7d18a7522294519c4 (patch) | |
| tree | 249397f5f24499ba3b25d11f2c88eb4ed3279025 /contrib/persistent-https | |
| parent | 94f057755b7941b321fd11fec1b2e3ca5313a4e0 (diff) | |
strbuf: add strbuf_add_uint()
strbuf_addf() calls vsnprintf(3) underneath, which supports a plethora
of formatting options. We can avoid its overhead in basic cases by
providing specialized functions like strbuf_addstr() for strings. Add
another one, strbuf_add_uint(), for unsigned integers.
Prepare the number string in a temporary buffer. Make it big enough for
any unsigned integer value: A decimal digit can represent ln(10)/ln(2) ≈
3.32 bits; dividing the number of bits of uintmax_t by 3.3 and rounding
up gives a sufficiently close conservative size estimate.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
