The out-of-memory handling in modules 'string-buffer' and 'xstring-buffer'
is not consistent: An OOM situation that occurred while accumulating the
string via functions without 'x' causes sb_xdupfree_c to return NULL,
while an OOM during sb_xdupfree_c (that is
The module 'string-buffer' supports creating a string piece by piece,
from the start to the end.
But in some cases, one needs to create a string piecemeal, from the end
to the start. Same thing, just in the opposite direction.
The C++ library authors would extend the 'string-
A misindentation in this commit:
> 2024-09-25 Bruno Haible
>
> string-buffer: Enable resource leak warnings from clang.
> * m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macros
> _GL_ATTRIBUTE_CAPABILITY_TYPE, _GL_ATTRIBUTE_ACQ
Michele Locati wrote:
> I tried checking gnulib in a similar environment [4], and there we
> have these failures:
> ...
> FAIL: test-string-buffer
>
> ../../gltests/test-string-buffer.c:159: assertion 'ret < 0' failed
> FAIL test-string-
While making use of the 'string-buffer' module in GNU gettext, I noticed
that more API is needed, to cover the frequent use-cases.
For code that is not performance-critical, the benefits of this module are:
- You need to declare one variable instead of 3 variables.
- It moves th
uisites are simple:
- Use clang ≥ 15.
- Use the warning option -Wthread-safety.
2024-09-25 Bruno Haible
string-buffer: Enable resource leak warnings from clang.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macros
_GL_ATTRIBUTE_CAPABILITY_TYPE, _GL_A
fails.)
2024-09-24 Bruno Haible
string-buffer: Remove INT_MAX limitation.
* lib/string-buffer.h (sb_appendvf, sb_appendf): Document that errno is
set upon failure.
* lib/string-buffer-printf.c: Include .
(sb_appendvf): Call vsnzprintf instead of vsnprintf. E
Some uses of the 'string-buffer' module don't need the *printf implementation.
In order to eliminate it from linking, when linking statically, this patch
splits up the module into two compilation units.
(The alternative would be a separate module 'string-buffer-printf
I did:
> 2023-09-04 Bruno Haible
>
> string-buffer tests: Fix a gcc -Wformat warning.
> * tests/test-string-buffer.c: Don't assume that wint_t has the same size
> as 'int'.
Oops, that doesn't even compile. Fix:
2023-09-04 Bruno Haible
that has this.
2023-09-04 Bruno Haible
string-buffer tests: Fix a gcc -Wformat warning.
* tests/test-string-buffer.c: Don't assume that wint_t has the same size
as 'int'.
diff --git a/tests/test-string-buffer.c b/tests/test-string-buffer.c
index 3d2
2021-08-07 Bruno Haible
string-buffer: Improve GCC 11 allocation-deallocation checking.
* lib/string-buffer.h: Include instead of .
(sb_dupfree): Declare that deallocation must happen through 'free'.
diff --git a/lib/string-buffer.h b/lib/string-buffer.h
ind
oes not fail when an invalid format directive is encountered, the
unit test failed.
2021-02-27 Bruno Haible
string-buffer: Fixes.
* modules/string-buffer (License): Change to LGPL.
* tests/test-string-buffer.c (main): Add another sb_appendf call, that
I
rolled my own.
But gnulib cannot provide a drop-in replacement since it would require
unportable stream hackery (worse that stdio-impl.h).
The alternative is a string buffer module. Gnulib has some modules that
sound good at first sight but don't fulfil the need:
I wanted something
-impl.h).
The alternative is a string buffer module. Gnulib has some modules that
sound good at first sight but don't fulfil the need:
* scratch_buffer stores only one size_t in the struct; it requires
the program to keep track how much of the buffer is already occupied.
Also it doe
Pádraig Brady wrote:
> Since there are lots of appending of strings here,
> the approach taken in coreutils so far was
> to append in a large buffer allocated up front,
> or just to write to stdout.
>
> I guess something in between is more appropriate for a lib.
> I.E. efficiently append to a stri
15 matches
Mail list logo