diffcore-rename, merge-ort: add wrapper functions for filepair alloc/dealloc

We want to be able to allocate filespecs and filepairs using a mem_pool.
However, filespec data will still remain outside the pool (perhaps in
the future we could plumb the pool through the various diff APIs to
allocate the filespec data too, but for now we are limiting the scope).
Add some extra functions to allocate these appropriately based on the
non-NULL-ness of opt->priv->pool, as well as some extra functions to
handle correctly deallocating the relevant parts of them.  A future
commit will make use of these new functions.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren
2021-07-30 11:47:41 +00:00
committed by Junio C Hamano
parent 6697ee01b5
commit a8791ef649
3 changed files with 85 additions and 0 deletions

View File

@ -127,6 +127,8 @@ struct diff_filepair {
#define DIFF_PAIR_MODE_CHANGED(p) ((p)->one->mode != (p)->two->mode)
void diff_free_filepair(struct diff_filepair *);
void pool_diff_free_filepair(struct mem_pool *pool,
struct diff_filepair *p);
int diff_unmodified_pair(struct diff_filepair *);