diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-11-25 08:34:43 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-11-26 08:39:38 +0900 |
| commit | ef46ad0815509c464e8a2558b4ebf6dc42736a01 (patch) | |
| tree | e1073d70a05b05110988ad94bd45e45a8a0122a3 /reftable/block.c | |
| parent | 0f5762b0435234c4dc916f4b3672c78c1b24f0e2 (diff) | |
| download | git-ef46ad0815509c464e8a2558b4ebf6dc42736a01.tar.xz | |
reftable: rename scratch buffer
Both `struct block_writer` and `struct reftable_writer` have a `buf`
member that is being reused to optimize the number of allocations.
Rename the variable to `scratch` to clarify its intend and provide a
comment explaining why it exists.
Suggested-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/block.c')
| -rw-r--r-- | reftable/block.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/reftable/block.c b/reftable/block.c index 1aa7e8cd3c..0198078485 100644 --- a/reftable/block.c +++ b/reftable/block.c @@ -115,16 +115,16 @@ int block_writer_add(struct block_writer *w, struct reftable_record *rec) int n = 0; int err; - err = reftable_record_key(rec, &w->buf); + err = reftable_record_key(rec, &w->scratch); if (err < 0) goto done; - if (!w->buf.len) { + if (!w->scratch.len) { err = REFTABLE_API_ERROR; goto done; } - n = reftable_encode_key(&is_restart, out, last, w->buf, + n = reftable_encode_key(&is_restart, out, last, w->scratch, reftable_record_val_type(rec)); if (n < 0) { err = -1; @@ -140,7 +140,7 @@ int block_writer_add(struct block_writer *w, struct reftable_record *rec) string_view_consume(&out, n); err = block_writer_register_restart(w, start.len - out.len, is_restart, - &w->buf); + &w->scratch); done: return err; } @@ -565,7 +565,7 @@ void block_writer_release(struct block_writer *bw) REFTABLE_FREE_AND_NULL(bw->zstream); REFTABLE_FREE_AND_NULL(bw->restarts); REFTABLE_FREE_AND_NULL(bw->compressed); - reftable_buf_release(&bw->buf); + reftable_buf_release(&bw->scratch); reftable_buf_release(&bw->last_key); /* the block is not owned. */ } |
