Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2023-12-11 12:08:12 +0300
committerJunio C Hamano <gitster@pobox.com>2023-12-11 18:23:17 +0300
commitc0cadb0576d4920915eb3bd38a7d1abfcbd25f98 (patch)
tree6ab32c33c20cf845b16325bc36ee2bedaa8082b4 /reftable/block.h
parenta8305bc6d8eb55cf52264964c8fc0289b72f2fd8 (diff)
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>
Diffstat (limited to 'reftable/block.h')
-rw-r--r--reftable/block.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/reftable/block.h b/reftable/block.h
index 51699af233..17481e6331 100644
--- a/reftable/block.h
+++ b/reftable/block.h
@@ -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. */