Skip to content

Commit c25cbcd

Browse files
Chandra Pratapgitster
authored andcommitted
t-reftable-block: use reftable_record_key() instead of strbuf_addstr()
In the current testing setup, the record key required for many block iterator functions is manually stored in a strbuf struct and then passed to these functions. This is not ideal when there exists a dedicated function to encode a record's key into a strbuf, namely reftable_record_key(). Use this function instead of manual encoding. Mentored-by: Patrick Steinhardt <[email protected]> Mentored-by: Christian Couder <[email protected]> Signed-off-by: Chandra Pratap <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e638e9c commit c25cbcd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

t/unit-tests/t-reftable-block.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ static void t_block_read_write(void)
8383

8484
for (i = 0; i < N; i++) {
8585
struct block_iter it = BLOCK_ITER_INIT;
86-
strbuf_reset(&want);
87-
strbuf_addstr(&want, recs[i].u.ref.refname);
86+
reftable_record_key(&recs[i], &want);
8887

8988
ret = block_iter_seek_key(&it, &br, &want);
9089
check_int(ret, ==, 0);

0 commit comments

Comments
 (0)