@@ -2259,6 +2259,27 @@ static void compute_collisions(struct strmap *collisions,
2259
2259
}
2260
2260
}
2261
2261
2262
+ static void free_collisions (struct strmap * collisions )
2263
+ {
2264
+ struct hashmap_iter iter ;
2265
+ struct strmap_entry * entry ;
2266
+
2267
+ /* Free each value in the collisions map */
2268
+ strmap_for_each_entry (collisions , & iter , entry ) {
2269
+ struct collision_info * info = entry -> value ;
2270
+ string_list_clear (& info -> source_files , 0 );
2271
+ }
2272
+ /*
2273
+ * In compute_collisions(), we set collisions.strdup_strings to 0
2274
+ * so that we wouldn't have to make another copy of the new_path
2275
+ * allocated by apply_dir_rename(). But now that we've used them
2276
+ * and have no other references to these strings, it is time to
2277
+ * deallocate them.
2278
+ */
2279
+ free_strmap_strings (collisions );
2280
+ strmap_clear (collisions , 1 );
2281
+ }
2282
+
2262
2283
static char * check_for_directory_rename (struct merge_options * opt ,
2263
2284
const char * path ,
2264
2285
unsigned side_index ,
@@ -3029,8 +3050,6 @@ static int collect_renames(struct merge_options *opt,
3029
3050
int i , clean = 1 ;
3030
3051
struct strmap collisions ;
3031
3052
struct diff_queue_struct * side_pairs ;
3032
- struct hashmap_iter iter ;
3033
- struct strmap_entry * entry ;
3034
3053
struct rename_info * renames = & opt -> priv -> renames ;
3035
3054
3036
3055
side_pairs = & renames -> pairs [side_index ];
@@ -3076,20 +3095,7 @@ static int collect_renames(struct merge_options *opt,
3076
3095
result -> queue [result -> nr ++ ] = p ;
3077
3096
}
3078
3097
3079
- /* Free each value in the collisions map */
3080
- strmap_for_each_entry (& collisions , & iter , entry ) {
3081
- struct collision_info * info = entry -> value ;
3082
- string_list_clear (& info -> source_files , 0 );
3083
- }
3084
- /*
3085
- * In compute_collisions(), we set collisions.strdup_strings to 0
3086
- * so that we wouldn't have to make another copy of the new_path
3087
- * allocated by apply_dir_rename(). But now that we've used them
3088
- * and have no other references to these strings, it is time to
3089
- * deallocate them.
3090
- */
3091
- free_strmap_strings (& collisions );
3092
- strmap_clear (& collisions , 1 );
3098
+ free_collisions (& collisions );
3093
3099
return clean ;
3094
3100
}
3095
3101
0 commit comments