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 <ps@pks.im> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e638e9c8f3
commit
c25cbcd352
@ -83,8 +83,7 @@ static void t_block_read_write(void)
|
|||||||
|
|
||||||
for (i = 0; i < N; i++) {
|
for (i = 0; i < N; i++) {
|
||||||
struct block_iter it = BLOCK_ITER_INIT;
|
struct block_iter it = BLOCK_ITER_INIT;
|
||||||
strbuf_reset(&want);
|
reftable_record_key(&recs[i], &want);
|
||||||
strbuf_addstr(&want, recs[i].u.ref.refname);
|
|
||||||
|
|
||||||
ret = block_iter_seek_key(&it, &br, &want);
|
ret = block_iter_seek_key(&it, &br, &want);
|
||||||
check_int(ret, ==, 0);
|
check_int(ret, ==, 0);
|
||||||
|
Reference in New Issue
Block a user