@@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,
2301
2301
size_t len , size_t postlen )
2302
2302
{
2303
2303
int i , ctx , reduced ;
2304
- char * new , * old , * fixed ;
2304
+ char * new_buf , * old_buf , * fixed ;
2305
2305
struct image fixed_preimage ;
2306
2306
2307
2307
/*
@@ -2327,25 +2327,25 @@ static void update_pre_post_images(struct image *preimage,
2327
2327
* We trust the caller to tell us if the update can be done
2328
2328
* in place (postlen==0) or not.
2329
2329
*/
2330
- old = postimage -> buf ;
2330
+ old_buf = postimage -> buf ;
2331
2331
if (postlen )
2332
- new = postimage -> buf = xmalloc (postlen );
2332
+ new_buf = postimage -> buf = xmalloc (postlen );
2333
2333
else
2334
- new = old ;
2334
+ new_buf = old_buf ;
2335
2335
fixed = preimage -> buf ;
2336
2336
2337
2337
for (i = reduced = ctx = 0 ; i < postimage -> nr ; i ++ ) {
2338
2338
size_t l_len = postimage -> line [i ].len ;
2339
2339
if (!(postimage -> line [i ].flag & LINE_COMMON )) {
2340
2340
/* an added line -- no counterparts in preimage */
2341
- memmove (new , old , l_len );
2342
- old += l_len ;
2343
- new += l_len ;
2341
+ memmove (new_buf , old_buf , l_len );
2342
+ old_buf += l_len ;
2343
+ new_buf += l_len ;
2344
2344
continue ;
2345
2345
}
2346
2346
2347
2347
/* a common context -- skip it in the original postimage */
2348
- old += l_len ;
2348
+ old_buf += l_len ;
2349
2349
2350
2350
/* and find the corresponding one in the fixed preimage */
2351
2351
while (ctx < preimage -> nr &&
@@ -2365,29 +2365,29 @@ static void update_pre_post_images(struct image *preimage,
2365
2365
2366
2366
/* and copy it in, while fixing the line length */
2367
2367
l_len = preimage -> line [ctx ].len ;
2368
- memcpy (new , fixed , l_len );
2369
- new += l_len ;
2368
+ memcpy (new_buf , fixed , l_len );
2369
+ new_buf += l_len ;
2370
2370
fixed += l_len ;
2371
2371
postimage -> line [i ].len = l_len ;
2372
2372
ctx ++ ;
2373
2373
}
2374
2374
2375
2375
if (postlen
2376
- ? postlen < new - postimage -> buf
2377
- : postimage -> len < new - postimage -> buf )
2376
+ ? postlen < new_buf - postimage -> buf
2377
+ : postimage -> len < new_buf - postimage -> buf )
2378
2378
die ("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d" ,
2379
- (int )postlen , (int ) postimage -> len , (int )(new - postimage -> buf ));
2379
+ (int )postlen , (int ) postimage -> len , (int )(new_buf - postimage -> buf ));
2380
2380
2381
2381
/* Fix the length of the whole thing */
2382
- postimage -> len = new - postimage -> buf ;
2382
+ postimage -> len = new_buf - postimage -> buf ;
2383
2383
postimage -> nr -= reduced ;
2384
2384
}
2385
2385
2386
2386
static int line_by_line_fuzzy_match (struct image * img ,
2387
2387
struct image * preimage ,
2388
2388
struct image * postimage ,
2389
- unsigned long try ,
2390
- int try_lno ,
2389
+ unsigned long current ,
2390
+ int current_lno ,
2391
2391
int preimage_limit )
2392
2392
{
2393
2393
int i ;
@@ -2404,9 +2404,9 @@ static int line_by_line_fuzzy_match(struct image *img,
2404
2404
2405
2405
for (i = 0 ; i < preimage_limit ; i ++ ) {
2406
2406
size_t prelen = preimage -> line [i ].len ;
2407
- size_t imglen = img -> line [try_lno + i ].len ;
2407
+ size_t imglen = img -> line [current_lno + i ].len ;
2408
2408
2409
- if (!fuzzy_matchlines (img -> buf + try + imgoff , imglen ,
2409
+ if (!fuzzy_matchlines (img -> buf + current + imgoff , imglen ,
2410
2410
preimage -> buf + preoff , prelen ))
2411
2411
return 0 ;
2412
2412
if (preimage -> line [i ].flag & LINE_COMMON )
@@ -2443,7 +2443,7 @@ static int line_by_line_fuzzy_match(struct image *img,
2443
2443
*/
2444
2444
extra_chars = preimage_end - preimage_eof ;
2445
2445
strbuf_init (& fixed , imgoff + extra_chars );
2446
- strbuf_add (& fixed , img -> buf + try , imgoff );
2446
+ strbuf_add (& fixed , img -> buf + current , imgoff );
2447
2447
strbuf_add (& fixed , preimage_eof , extra_chars );
2448
2448
fixed_buf = strbuf_detach (& fixed , & fixed_len );
2449
2449
update_pre_post_images (preimage , postimage ,
@@ -2455,8 +2455,8 @@ static int match_fragment(struct apply_state *state,
2455
2455
struct image * img ,
2456
2456
struct image * preimage ,
2457
2457
struct image * postimage ,
2458
- unsigned long try ,
2459
- int try_lno ,
2458
+ unsigned long current ,
2459
+ int current_lno ,
2460
2460
unsigned ws_rule ,
2461
2461
int match_beginning , int match_end )
2462
2462
{
@@ -2466,12 +2466,12 @@ static int match_fragment(struct apply_state *state,
2466
2466
size_t fixed_len , postlen ;
2467
2467
int preimage_limit ;
2468
2468
2469
- if (preimage -> nr + try_lno <= img -> nr ) {
2469
+ if (preimage -> nr + current_lno <= img -> nr ) {
2470
2470
/*
2471
2471
* The hunk falls within the boundaries of img.
2472
2472
*/
2473
2473
preimage_limit = preimage -> nr ;
2474
- if (match_end && (preimage -> nr + try_lno != img -> nr ))
2474
+ if (match_end && (preimage -> nr + current_lno != img -> nr ))
2475
2475
return 0 ;
2476
2476
} else if (state -> ws_error_action == correct_ws_error &&
2477
2477
(ws_rule & WS_BLANK_AT_EOF )) {
@@ -2482,7 +2482,7 @@ static int match_fragment(struct apply_state *state,
2482
2482
* match with img, and the remainder of the preimage
2483
2483
* must be blank.
2484
2484
*/
2485
- preimage_limit = img -> nr - try_lno ;
2485
+ preimage_limit = img -> nr - current_lno ;
2486
2486
} else {
2487
2487
/*
2488
2488
* The hunk extends beyond the end of the img and
@@ -2492,27 +2492,27 @@ static int match_fragment(struct apply_state *state,
2492
2492
return 0 ;
2493
2493
}
2494
2494
2495
- if (match_beginning && try_lno )
2495
+ if (match_beginning && current_lno )
2496
2496
return 0 ;
2497
2497
2498
2498
/* Quick hash check */
2499
2499
for (i = 0 ; i < preimage_limit ; i ++ )
2500
- if ((img -> line [try_lno + i ].flag & LINE_PATCHED ) ||
2501
- (preimage -> line [i ].hash != img -> line [try_lno + i ].hash ))
2500
+ if ((img -> line [current_lno + i ].flag & LINE_PATCHED ) ||
2501
+ (preimage -> line [i ].hash != img -> line [current_lno + i ].hash ))
2502
2502
return 0 ;
2503
2503
2504
2504
if (preimage_limit == preimage -> nr ) {
2505
2505
/*
2506
2506
* Do we have an exact match? If we were told to match
2507
- * at the end, size must be exactly at try +fragsize,
2508
- * otherwise try +fragsize must be still within the preimage,
2507
+ * at the end, size must be exactly at current +fragsize,
2508
+ * otherwise current +fragsize must be still within the preimage,
2509
2509
* and either case, the old piece should match the preimage
2510
2510
* exactly.
2511
2511
*/
2512
2512
if ((match_end
2513
- ? (try + preimage -> len == img -> len )
2514
- : (try + preimage -> len <= img -> len )) &&
2515
- !memcmp (img -> buf + try , preimage -> buf , preimage -> len ))
2513
+ ? (current + preimage -> len == img -> len )
2514
+ : (current + preimage -> len <= img -> len )) &&
2515
+ !memcmp (img -> buf + current , preimage -> buf , preimage -> len ))
2516
2516
return 1 ;
2517
2517
} else {
2518
2518
/*
@@ -2543,7 +2543,7 @@ static int match_fragment(struct apply_state *state,
2543
2543
*/
2544
2544
if (state -> ws_ignore_action == ignore_ws_change )
2545
2545
return line_by_line_fuzzy_match (img , preimage , postimage ,
2546
- try , try_lno , preimage_limit );
2546
+ current , current_lno , preimage_limit );
2547
2547
2548
2548
if (state -> ws_error_action != correct_ws_error )
2549
2549
return 0 ;
@@ -2577,10 +2577,10 @@ static int match_fragment(struct apply_state *state,
2577
2577
*/
2578
2578
strbuf_init (& fixed , preimage -> len + 1 );
2579
2579
orig = preimage -> buf ;
2580
- target = img -> buf + try ;
2580
+ target = img -> buf + current ;
2581
2581
for (i = 0 ; i < preimage_limit ; i ++ ) {
2582
2582
size_t oldlen = preimage -> line [i ].len ;
2583
- size_t tgtlen = img -> line [try_lno + i ].len ;
2583
+ size_t tgtlen = img -> line [current_lno + i ].len ;
2584
2584
size_t fixstart = fixed .len ;
2585
2585
struct strbuf tgtfix ;
2586
2586
int match ;
@@ -2666,8 +2666,8 @@ static int find_pos(struct apply_state *state,
2666
2666
int match_beginning , int match_end )
2667
2667
{
2668
2668
int i ;
2669
- unsigned long backwards , forwards , try ;
2670
- int backwards_lno , forwards_lno , try_lno ;
2669
+ unsigned long backwards , forwards , current ;
2670
+ int backwards_lno , forwards_lno , current_lno ;
2671
2671
2672
2672
/*
2673
2673
* If match_beginning or match_end is specified, there is no
@@ -2687,25 +2687,25 @@ static int find_pos(struct apply_state *state,
2687
2687
if ((size_t ) line > img -> nr )
2688
2688
line = img -> nr ;
2689
2689
2690
- try = 0 ;
2690
+ current = 0 ;
2691
2691
for (i = 0 ; i < line ; i ++ )
2692
- try += img -> line [i ].len ;
2692
+ current += img -> line [i ].len ;
2693
2693
2694
2694
/*
2695
2695
* There's probably some smart way to do this, but I'll leave
2696
2696
* that to the smart and beautiful people. I'm simple and stupid.
2697
2697
*/
2698
- backwards = try ;
2698
+ backwards = current ;
2699
2699
backwards_lno = line ;
2700
- forwards = try ;
2700
+ forwards = current ;
2701
2701
forwards_lno = line ;
2702
- try_lno = line ;
2702
+ current_lno = line ;
2703
2703
2704
2704
for (i = 0 ; ; i ++ ) {
2705
2705
if (match_fragment (state , img , preimage , postimage ,
2706
- try , try_lno , ws_rule ,
2706
+ current , current_lno , ws_rule ,
2707
2707
match_beginning , match_end ))
2708
- return try_lno ;
2708
+ return current_lno ;
2709
2709
2710
2710
again :
2711
2711
if (backwards_lno == 0 && forwards_lno == img -> nr )
@@ -2718,17 +2718,17 @@ static int find_pos(struct apply_state *state,
2718
2718
}
2719
2719
backwards_lno -- ;
2720
2720
backwards -= img -> line [backwards_lno ].len ;
2721
- try = backwards ;
2722
- try_lno = backwards_lno ;
2721
+ current = backwards ;
2722
+ current_lno = backwards_lno ;
2723
2723
} else {
2724
2724
if (forwards_lno == img -> nr ) {
2725
2725
i ++ ;
2726
2726
goto again ;
2727
2727
}
2728
2728
forwards += img -> line [forwards_lno ].len ;
2729
2729
forwards_lno ++ ;
2730
- try = forwards ;
2731
- try_lno = forwards_lno ;
2730
+ current = forwards ;
2731
+ current_lno = forwards_lno ;
2732
2732
}
2733
2733
2734
2734
}
@@ -4163,30 +4163,30 @@ static void show_mode_change(struct patch *p, int show_name)
4163
4163
static void show_rename_copy (struct patch * p )
4164
4164
{
4165
4165
const char * renamecopy = p -> is_rename ? "rename" : "copy" ;
4166
- const char * old , * new ;
4166
+ const char * old_name , * new_name ;
4167
4167
4168
4168
/* Find common prefix */
4169
- old = p -> old_name ;
4170
- new = p -> new_name ;
4169
+ old_name = p -> old_name ;
4170
+ new_name = p -> new_name ;
4171
4171
while (1 ) {
4172
4172
const char * slash_old , * slash_new ;
4173
- slash_old = strchr (old , '/' );
4174
- slash_new = strchr (new , '/' );
4173
+ slash_old = strchr (old_name , '/' );
4174
+ slash_new = strchr (new_name , '/' );
4175
4175
if (!slash_old ||
4176
4176
!slash_new ||
4177
- slash_old - old != slash_new - new ||
4178
- memcmp (old , new , slash_new - new ))
4177
+ slash_old - old_name != slash_new - new_name ||
4178
+ memcmp (old_name , new_name , slash_new - new_name ))
4179
4179
break ;
4180
- old = slash_old + 1 ;
4181
- new = slash_new + 1 ;
4180
+ old_name = slash_old + 1 ;
4181
+ new_name = slash_new + 1 ;
4182
4182
}
4183
- /* p->old_name thru old is the common prefix, and old and new
4183
+ /* p->old_name thru old_name is the common prefix, and old_name and new_name
4184
4184
* through the end of names are renames
4185
4185
*/
4186
- if (old != p -> old_name )
4186
+ if (old_name != p -> old_name )
4187
4187
printf (" %s %.*s{%s => %s} (%d%%)\n" , renamecopy ,
4188
- (int )(old - p -> old_name ), p -> old_name ,
4189
- old , new , p -> score );
4188
+ (int )(old_name - p -> old_name ), p -> old_name ,
4189
+ old_name , new_name , p -> score );
4190
4190
else
4191
4191
printf (" %s %s => %s (%d%%)\n" , renamecopy ,
4192
4192
p -> old_name , p -> new_name , p -> score );
0 commit comments