reftable/block: reuse buffer to compute record keys
When iterating over entries in the block iterator we compute the key of each of the entries and write it into a buffer. We do not reuse the buffer though and thus re-allocate it on every iteration, which is wasteful. Refactor the code to reuse the buffer. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a8305bc6d8
commit
c0cadb0576
@ -84,10 +84,12 @@ struct block_iter {
|
||||
|
||||
/* key for last entry we read. */
|
||||
struct strbuf last_key;
|
||||
struct strbuf key;
|
||||
};
|
||||
|
||||
#define BLOCK_ITER_INIT { \
|
||||
.last_key = STRBUF_INIT, \
|
||||
.key = STRBUF_INIT, \
|
||||
}
|
||||
|
||||
/* initializes a block reader. */
|
||||
|
Reference in New Issue
Block a user