diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-02-12 13:16:10 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-02-12 13:16:10 -0800 |
| commit | f424d7c33df373fb8eb4c9dc63ab6dc24de24aa5 (patch) | |
| tree | 0a4a0ce4fd72be818d68f736c9eb98a42edbe123 /reftable/readwrite_test.c | |
| parent | Merge branch 'ps/reftable-multi-level-indices-fix' (diff) | |
| parent | reftable/record: improve semantics when initializing records (diff) | |
| download | git-f424d7c33df373fb8eb4c9dc63ab6dc24de24aa5.tar.gz git-f424d7c33df373fb8eb4c9dc63ab6dc24de24aa5.zip | |
Merge branch 'ps/reftable-styles'
Code clean-up in various reftable code paths.
* ps/reftable-styles:
reftable/record: improve semantics when initializing records
reftable/merged: refactor initialization of iterators
reftable/merged: refactor seeking of records
reftable/stack: use `size_t` to track stack length
reftable/stack: use `size_t` to track stack slices during compaction
reftable/stack: index segments with `size_t`
reftable/stack: fix parameter validation when compacting range
reftable: introduce macros to allocate arrays
reftable: introduce macros to grow arrays
Diffstat (limited to 'reftable/readwrite_test.c')
| -rw-r--r-- | reftable/readwrite_test.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/reftable/readwrite_test.c b/reftable/readwrite_test.c index 853923397e..363fe0f998 100644 --- a/reftable/readwrite_test.c +++ b/reftable/readwrite_test.c @@ -56,7 +56,9 @@ static void write_table(char ***names, struct strbuf *buf, int N, int i = 0, n; struct reftable_log_record log = { NULL }; const struct reftable_stats *stats = NULL; - *names = reftable_calloc(sizeof(char *) * (N + 1)); + + REFTABLE_CALLOC_ARRAY(*names, N + 1); + reftable_writer_set_limits(w, update_index, update_index); for (i = 0; i < N; i++) { char name[100]; @@ -188,7 +190,7 @@ static void test_log_overflow(void) static void test_log_write_read(void) { int N = 2; - char **names = reftable_calloc(sizeof(char *) * (N + 1)); + char **names = reftable_calloc(N + 1, sizeof(*names)); int err; struct reftable_write_options opts = { .block_size = 256, @@ -519,7 +521,7 @@ static void test_table_read_write_seek_index(void) static void test_table_refs_for(int indexed) { int N = 50; - char **want_names = reftable_calloc(sizeof(char *) * (N + 1)); + char **want_names = reftable_calloc(N + 1, sizeof(*want_names)); int want_names_len = 0; uint8_t want_hash[GIT_SHA1_RAWSZ]; |
