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:
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 73d884099e..5bc559f79e 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -1328,6 +1328,47 @@ static void handle_early_known_dir_renames(struct dir_rename_info *info,
rename_src_nr = new_num_src;
}
+static void free_filespec_data(struct diff_filespec *spec)
+{
+ if (!--spec->count)
+ diff_free_filespec_data(spec);
+}
+
+MAYBE_UNUSED
+static void pool_free_filespec(struct mem_pool *pool,
+ struct diff_filespec *spec)
+{
+ if (!pool) {
+ free_filespec(spec);
+ return;
+ }
+
+ /*
+ * Similar to free_filespec(), but only frees the data. The spec
+ * itself was allocated in the pool and should not be individually
+ * freed.
+ */
+ free_filespec_data(spec);
+}
+
+MAYBE_UNUSED
+void pool_diff_free_filepair(struct mem_pool *pool,
+ struct diff_filepair *p)
+{
+ if (!pool) {
+ diff_free_filepair(p);
+ return;
+ }
+
+ /*
+ * Similar to diff_free_filepair() but only frees the data from the
+ * filespecs; not the filespecs or the filepair which were
+ * allocated from the pool.
+ */
+ free_filespec_data(p->one);
+ free_filespec_data(p->two);
+}
+
void diffcore_rename_extended(struct diff_options *options,
struct strintmap *relevant_sources,
struct strintmap *dirs_removed,