summaryrefslogtreecommitdiff
path: root/t/unit-tests/lib-reftable.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-10-02 12:55:48 +0200
committerJunio C Hamano <gitster@pobox.com>2024-10-02 07:53:52 -0700
commit74d1c18757d1a45b95e46836adf478193a34c42c (patch)
treef22d6b124adedd5b978c07e4792b0609fef9c27b /t/unit-tests/lib-reftable.c
parentb680af2dba27f851d3cea2000094a1dc42f38cd2 (diff)
reftable/writer: handle allocation failures in `reftable_new_writer()`
Handle allocation failures in `reftable_new_writer()`. Adapt the function to return an error code to return such failures. While at it, rename it to match our code style as we have to touch up every callsite anyway. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/lib-reftable.c')
-rw-r--r--t/unit-tests/lib-reftable.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/t/unit-tests/lib-reftable.c b/t/unit-tests/lib-reftable.c
index ab1fa44a28..54c26c43e7 100644
--- a/t/unit-tests/lib-reftable.c
+++ b/t/unit-tests/lib-reftable.c
@@ -22,9 +22,11 @@ static int strbuf_writer_flush(void *arg UNUSED)
struct reftable_writer *t_reftable_strbuf_writer(struct strbuf *buf,
struct reftable_write_options *opts)
{
- return reftable_new_writer(&strbuf_writer_write,
- &strbuf_writer_flush,
- buf, opts);
+ struct reftable_writer *writer;
+ int ret = reftable_writer_new(&writer, &strbuf_writer_write, &strbuf_writer_flush,
+ buf, opts);
+ check(!ret);
+ return writer;
}
void t_reftable_write_to_buf(struct strbuf *buf,