diffcore-rename: rename num_create to num_destinations
Our main data structures are rename_src and rename_dst. For counters of these data structures, num_sources and num_destinations seem natural; definitely more so than using num_create for the latter. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Dec 11, 2020 at 09:08 UTC
26a66a6b1c653bc6c05534016992985d48267d70
1 file changed
+13
-12
diffcore-rename.c
+13
-12
@@ -434,7 +434,7 @@ static void record_if_better(struct diff_score m[], struct diff_score *o)
434
* 1 if we need to disable inexact rename detection;
435
* 2 if we would be under the limit if we were given -C instead of -C -C.
436
*/
437
-static int too_many_rename_candidates(int num_create,
437
+static int too_many_rename_candidates(int num_destinations,
438
struct diff_options *options)
439
{
440
int rename_limit = options->rename_limit;
@@ -447,17 +447,17 @@ static int too_many_rename_candidates(int num_create,
447
* This basically does a test for the rename matrix not
448
* growing larger than a "rename_limit" square matrix, ie:
449
*
450
- * num_create * num_src > rename_limit * rename_limit
450
+ * num_destinations * num_src > rename_limit * rename_limit
451
*/
452
if (rename_limit <= 0)
453
rename_limit = 32767;
454
- if ((num_create <= rename_limit || num_src <= rename_limit) &&
455
- ((uint64_t)num_create * (uint64_t)num_src
454
+ if ((num_destinations <= rename_limit || num_src <= rename_limit) &&
455
+ ((uint64_t)num_destinations * (uint64_t)num_src
456
<= (uint64_t)rename_limit * (uint64_t)rename_limit))
457
return 0;
458
459
options->needed_rename_limit =
460
- num_src > num_create ? num_src : num_create;
460
+ num_src > num_destinations ? num_src : num_destinations;
461
462
/* Are we running under -C -C? */
463
if (!options->flags.find_copies_harder)
@@ -469,8 +469,8 @@ static int too_many_rename_candidates(int num_create,
469
continue;
470
num_src++;
471
}
472
- if ((num_create <= rename_limit || num_src <= rename_limit) &&
473
- ((uint64_t)num_create * (uint64_t)num_src
472
+ if ((num_destinations <= rename_limit || num_src <= rename_limit) &&
473
+ ((uint64_t)num_destinations * (uint64_t)num_src
474
<= (uint64_t)rename_limit * (uint64_t)rename_limit))
475
return 2;
476
return 1;
@@ -505,7 +505,7 @@ void diffcore_rename(struct diff_options *options)
505
struct diff_queue_struct outq;
506
struct diff_score *mx;
507
int i, j, rename_count, skip_unmodified = 0;
508
- int num_create, dst_cnt;
508
+ int num_destinations, dst_cnt;
509
struct progress *progress = NULL;
510
511
if (!minimum_score)
@@ -570,13 +570,13 @@ void diffcore_rename(struct diff_options *options)
570
* Calculate how many renames are left (but all the source
571
* files still remain as options for rename/copies!)
572
*/
573
- num_create = (rename_dst_nr - rename_count);
573
+ num_destinations = (rename_dst_nr - rename_count);
574
575
/* All done? */
576
- if (!num_create)
576
+ if (!num_destinations)
577
goto cleanup;
578
579
- switch (too_many_rename_candidates(num_create, options)) {
579
+ switch (too_many_rename_candidates(num_destinations, options)) {
580
case 1:
581
goto cleanup;
582
case 2:
@@ -593,7 +593,8 @@ void diffcore_rename(struct diff_options *options)
593
(uint64_t)rename_dst_nr * (uint64_t)rename_src_nr);
594
}
595
596
- mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_create), sizeof(*mx));
596
+ mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_destinations),
597
+ sizeof(*mx));
598
for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
599
struct diff_filespec *two = rename_dst[i].two;
600
struct diff_score *m;