}
}
+static void clear_internal_opts(struct merge_options_internal *opti,
+ int reinitialize)
+{
+ assert(!reinitialize);
+
+ /*
+ * We marked opti->paths with strdup_strings = 0, so that we
+ * wouldn't have to make another copy of the fullpath created by
+ * make_traverse_path from setup_path_info(). But, now that we've
+ * used it and have no other references to these strings, it is time
+ * to deallocate them.
+ */
+ free_strmap_strings(&opti->paths);
+ strmap_clear(&opti->paths, 1);
+
+ /*
+ * All keys and values in opti->conflicted are a subset of those in
+ * opti->paths. We don't want to deallocate anything twice, so we
+ * don't free the keys and we pass 0 for free_values.
+ */
+ strmap_clear(&opti->conflicted, 0);
+}
+
static int err(struct merge_options *opt, const char *err, ...)
{
va_list params;
assert(opt->priv == NULL);
- /*
- * We marked opti->paths with strdup_strings = 0, so that we
- * wouldn't have to make another copy of the fullpath created by
- * make_traverse_path from setup_path_info(). But, now that we've
- * used it and have no other references to these strings, it is time
- * to deallocate them.
- */
- free_strmap_strings(&opti->paths);
- strmap_clear(&opti->paths, 1);
-
- /*
- * All keys and values in opti->conflicted are a subset of those in
- * opti->paths. We don't want to deallocate anything twice, so we
- * don't free the keys and we pass 0 for free_values.
- */
- strmap_clear(&opti->conflicted, 0);
+ clear_internal_opts(opti, 0);
FREE_AND_NULL(opti);
}