aboutsummaryrefslogtreecommitdiffstats
path: root/t/unit-tests/t-reftable-basics.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-10-10 14:22:24 -0700
committerJunio C Hamano <gitster@pobox.com>2024-10-10 14:22:25 -0700
commit5575c713c2a398f4723c544fb732c44b8e1d5e45 (patch)
tree05f7f70eaf278c2bf07498a6d5807915bc3d40e4 /t/unit-tests/t-reftable-basics.c
parent799450316b606d4b6cd5db6a6cc814f1710d923f (diff)
parent2179b5c831f6bc286acda15c7c7f4a573291ee5c (diff)
downloadgit-5575c713c2a398f4723c544fb732c44b8e1d5e45.tar.gz
Merge branch 'ps/reftable-alloc-failures'
The reftable library is now prepared to expect that the memory allocation function given to it may fail to allocate and to deal with such an error. * ps/reftable-alloc-failures: (26 commits) reftable/basics: fix segfault when growing `names` array fails reftable/basics: ban standard allocator functions reftable: introduce `REFTABLE_FREE_AND_NULL()` reftable: fix calls to free(3P) reftable: handle trivial allocation failures reftable/tree: handle allocation failures reftable/pq: handle allocation failures when adding entries reftable/block: handle allocation failures reftable/blocksource: handle allocation failures reftable/iter: handle allocation failures when creating indexed table iter reftable/stack: handle allocation failures in auto compaction reftable/stack: handle allocation failures in `stack_compact_range()` reftable/stack: handle allocation failures in `reftable_new_stack()` reftable/stack: handle allocation failures on reload reftable/reader: handle allocation failures in `reader_init_iter()` reftable/reader: handle allocation failures for unindexed reader reftable/merged: handle allocation failures in `merged_table_init_iter()` reftable/writer: handle allocation failures in `reftable_new_writer()` reftable/writer: handle allocation failures in `writer_index_hash()` reftable/record: handle allocation failures when decoding records ...
Diffstat (limited to 't/unit-tests/t-reftable-basics.c')
-rw-r--r--t/unit-tests/t-reftable-basics.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/t/unit-tests/t-reftable-basics.c b/t/unit-tests/t-reftable-basics.c
index e5556ebf52..1fa77b6faf 100644
--- a/t/unit-tests/t-reftable-basics.c
+++ b/t/unit-tests/t-reftable-basics.c
@@ -72,13 +72,14 @@ int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
if_test ("parse_names works for basic input") {
char in1[] = "line\n";
char in2[] = "a\nb\nc";
- char **out = NULL;
- parse_names(in1, strlen(in1), &out);
+ char **out = parse_names(in1, strlen(in1));
+ check(out != NULL);
check_str(out[0], "line");
check(!out[1]);
free_names(out);
- parse_names(in2, strlen(in2), &out);
+ out = parse_names(in2, strlen(in2));
+ check(out != NULL);
check_str(out[0], "a");
check_str(out[1], "b");
check_str(out[2], "c");
@@ -88,8 +89,8 @@ int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
if_test ("parse_names drops empty string") {
char in[] = "a\n\nb\n";
- char **out = NULL;
- parse_names(in, strlen(in), &out);
+ char **out = parse_names(in, strlen(in));
+ check(out != NULL);
check_str(out[0], "a");
/* simply '\n' should be dropped as empty string */
check_str(out[1], "b");