summaryrefslogtreecommitdiff
path: root/merge-ort.c
diff options
context:
space:
mode:
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/merge-ort.c b/merge-ort.c
index 99c7569085..e79830f918 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -690,6 +690,48 @@ static void path_msg(struct merge_options *opt,
strbuf_addch(sb, '\n');
}
+MAYBE_UNUSED
+static struct diff_filespec *pool_alloc_filespec(struct mem_pool *pool,
+ const char *path)
+{
+ struct diff_filespec *spec;
+ size_t len;
+
+ if (!pool)
+ return alloc_filespec(path);
+
+ /* Same code as alloc_filespec, except allocate from pool */
+ len = strlen(path);
+
+ spec = mem_pool_calloc(pool, 1, st_add3(sizeof(*spec), len, 1));
+ memcpy(spec+1, path, len);
+ spec->path = (void*)(spec+1);
+
+ spec->count = 1;
+ spec->is_binary = -1;
+ return spec;
+}
+
+MAYBE_UNUSED
+static struct diff_filepair *pool_diff_queue(struct mem_pool *pool,
+ struct diff_queue_struct *queue,
+ struct diff_filespec *one,
+ struct diff_filespec *two)
+{
+ struct diff_filepair *dp;
+
+ if (!pool)
+ return diff_queue(queue, one, two);
+
+ /* Same code as diff_queue, except allocate from pool */
+ dp = mem_pool_calloc(pool, 1, sizeof(*dp));
+ dp->one = one;
+ dp->two = two;
+ if (queue)
+ diff_q(queue, dp);
+ return dp;
+}
+
static void *pool_calloc(struct mem_pool *pool, size_t count, size_t size)
{
if (!pool)