summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--reftable/block_test.c3
-rw-r--r--reftable/blocksource.c20
-rw-r--r--reftable/blocksource.h2
3 files changed, 2 insertions, 23 deletions
diff --git a/reftable/block_test.c b/reftable/block_test.c
index 90aecd5a7c..de8f426a42 100644
--- a/reftable/block_test.c
+++ b/reftable/block_test.c
@@ -34,11 +34,12 @@ static void test_block_read_write(void)
struct block_reader br = { 0 };
struct block_iter it = BLOCK_ITER_INIT;
int j = 0;
+ struct strbuf block_data = STRBUF_INIT;
struct strbuf want = STRBUF_INIT;
REFTABLE_CALLOC_ARRAY(block.data, block_size);
block.len = block_size;
- block.source = malloc_block_source();
+ block_source_from_strbuf(&block.source, &block_data);
block_writer_init(&bw, BLOCK_TYPE_REF, block.data, block_size,
header_off, hash_size(GIT_SHA1_FORMAT_ID));
diff --git a/reftable/blocksource.c b/reftable/blocksource.c
index eeed254ba9..1774853011 100644
--- a/reftable/blocksource.c
+++ b/reftable/blocksource.c
@@ -55,26 +55,6 @@ void block_source_from_strbuf(struct reftable_block_source *bs,
bs->arg = buf;
}
-static void malloc_return_block(void *b, struct reftable_block *dest)
-{
- if (dest->len)
- memset(dest->data, 0xff, dest->len);
- reftable_free(dest->data);
-}
-
-static struct reftable_block_source_vtable malloc_vtable = {
- .return_block = &malloc_return_block,
-};
-
-static struct reftable_block_source malloc_block_source_instance = {
- .ops = &malloc_vtable,
-};
-
-struct reftable_block_source malloc_block_source(void)
-{
- return malloc_block_source_instance;
-}
-
struct file_block_source {
uint64_t size;
unsigned char *data;
diff --git a/reftable/blocksource.h b/reftable/blocksource.h
index 072e2727ad..659a27b406 100644
--- a/reftable/blocksource.h
+++ b/reftable/blocksource.h
@@ -17,6 +17,4 @@ struct reftable_block_source;
void block_source_from_strbuf(struct reftable_block_source *bs,
struct strbuf *buf);
-struct reftable_block_source malloc_block_source(void);
-
#endif