Skip to content

Commit 26a66a6

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3a0b884 commit 26a66a6

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

diffcore-rename.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static void record_if_better(struct diff_score m[], struct diff_score *o)
434434
* 1 if we need to disable inexact rename detection;
435435
* 2 if we would be under the limit if we were given -C instead of -C -C.
436436
*/
437-
static int too_many_rename_candidates(int num_create,
437+
static int too_many_rename_candidates(int num_destinations,
438438
struct diff_options *options)
439439
{
440440
int rename_limit = options->rename_limit;
@@ -447,17 +447,17 @@ static int too_many_rename_candidates(int num_create,
447447
* This basically does a test for the rename matrix not
448448
* growing larger than a "rename_limit" square matrix, ie:
449449
*
450-
* num_create * num_src > rename_limit * rename_limit
450+
* num_destinations * num_src > rename_limit * rename_limit
451451
*/
452452
if (rename_limit <= 0)
453453
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
456456
<= (uint64_t)rename_limit * (uint64_t)rename_limit))
457457
return 0;
458458

459459
options->needed_rename_limit =
460-
num_src > num_create ? num_src : num_create;
460+
num_src > num_destinations ? num_src : num_destinations;
461461

462462
/* Are we running under -C -C? */
463463
if (!options->flags.find_copies_harder)
@@ -469,8 +469,8 @@ static int too_many_rename_candidates(int num_create,
469469
continue;
470470
num_src++;
471471
}
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
474474
<= (uint64_t)rename_limit * (uint64_t)rename_limit))
475475
return 2;
476476
return 1;
@@ -505,7 +505,7 @@ void diffcore_rename(struct diff_options *options)
505505
struct diff_queue_struct outq;
506506
struct diff_score *mx;
507507
int i, j, rename_count, skip_unmodified = 0;
508-
int num_create, dst_cnt;
508+
int num_destinations, dst_cnt;
509509
struct progress *progress = NULL;
510510

511511
if (!minimum_score)
@@ -570,13 +570,13 @@ void diffcore_rename(struct diff_options *options)
570570
* Calculate how many renames are left (but all the source
571571
* files still remain as options for rename/copies!)
572572
*/
573-
num_create = (rename_dst_nr - rename_count);
573+
num_destinations = (rename_dst_nr - rename_count);
574574

575575
/* All done? */
576-
if (!num_create)
576+
if (!num_destinations)
577577
goto cleanup;
578578

579-
switch (too_many_rename_candidates(num_create, options)) {
579+
switch (too_many_rename_candidates(num_destinations, options)) {
580580
case 1:
581581
goto cleanup;
582582
case 2:
@@ -593,7 +593,8 @@ void diffcore_rename(struct diff_options *options)
593593
(uint64_t)rename_dst_nr * (uint64_t)rename_src_nr);
594594
}
595595

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));
597598
for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
598599
struct diff_filespec *two = rename_dst[i].two;
599600
struct diff_score *m;

0 commit comments

Comments
 (0)