]> Savannah Git Hosting - gnulib.git/commit
string-buffer, string-buffer-reversed: Make OOM handling consistent.
authorBruno Haible <bruno@clisp.org>
Sun, 9 Feb 2025 15:56:39 +0000 (16:56 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Feb 2025 15:56:39 +0000 (16:56 +0100)
commit39b0a871d6078d7c51337bb67d10e251cdab7be8
treecee95197655f96aa8441086986bc9e743ad89ab6
parent910fc17ebb8b3425416cea62fb84091618d75db9
string-buffer, string-buffer-reversed: Make OOM handling consistent.

* lib/string-buffer.h (struct string_buffer): New field 'oom'.
* lib/string-buffer.c (sb_init): Initialize the 'oom' field.
(sb_append1, sb_append_desc, sb_append_c): Upon out-of-memory, set
buffer->oom, not buffer->error.
(sb_dupfree, sb_dupfree_c): If there was an OOM, return NULL.
* lib/string-buffer-printf.c (sb_appendvf, sb_appendf): Upon
out-of-memory, set buffer->oom, not buffer->error.
* lib/string-buffer-reversed.h (struct string_buffer_reversed): New
field 'oom'.
* lib/string-buffer-reversed.c (sbr_init): Initialize the 'oom' field.
(sbr_prepend1, sbr_prepend_desc, sbr_prepend_c): Upon out-of-memory, set
buffer->oom, not buffer->error.
(sbr_dupfree, sbr_dupfree_c): If there was an OOM, return NULL.
* lib/string-buffer-reversed-printf.c (sbr_prependvf, sbr_prependf):
Upon out-of-memory, set buffer->oom, not buffer->error.
ChangeLog
lib/string-buffer-printf.c
lib/string-buffer-reversed-printf.c
lib/string-buffer-reversed.c
lib/string-buffer-reversed.h
lib/string-buffer.c
lib/string-buffer.h