@@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,
23012301 size_t len , size_t postlen )
23022302{
23032303 int i , ctx , reduced ;
2304- char * new , * old , * fixed ;
2304+ char * new_buf , * old_buf , * fixed ;
23052305 struct image fixed_preimage ;
23062306
23072307 /*
@@ -2327,25 +2327,25 @@ static void update_pre_post_images(struct image *preimage,
23272327 * We trust the caller to tell us if the update can be done
23282328 * in place (postlen==0) or not.
23292329 */
2330- old = postimage -> buf ;
2330+ old_buf = postimage -> buf ;
23312331 if (postlen )
2332- new = postimage -> buf = xmalloc (postlen );
2332+ new_buf = postimage -> buf = xmalloc (postlen );
23332333 else
2334- new = old ;
2334+ new_buf = old_buf ;
23352335 fixed = preimage -> buf ;
23362336
23372337 for (i = reduced = ctx = 0 ; i < postimage -> nr ; i ++ ) {
23382338 size_t l_len = postimage -> line [i ].len ;
23392339 if (!(postimage -> line [i ].flag & LINE_COMMON )) {
23402340 /* 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 ;
23442344 continue ;
23452345 }
23462346
23472347 /* a common context -- skip it in the original postimage */
2348- old += l_len ;
2348+ old_buf += l_len ;
23492349
23502350 /* and find the corresponding one in the fixed preimage */
23512351 while (ctx < preimage -> nr &&
@@ -2365,29 +2365,29 @@ static void update_pre_post_images(struct image *preimage,
23652365
23662366 /* and copy it in, while fixing the line length */
23672367 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 ;
23702370 fixed += l_len ;
23712371 postimage -> line [i ].len = l_len ;
23722372 ctx ++ ;
23732373 }
23742374
23752375 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 )
23782378 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 ));
23802380
23812381 /* Fix the length of the whole thing */
2382- postimage -> len = new - postimage -> buf ;
2382+ postimage -> len = new_buf - postimage -> buf ;
23832383 postimage -> nr -= reduced ;
23842384}
23852385
23862386static int line_by_line_fuzzy_match (struct image * img ,
23872387 struct image * preimage ,
23882388 struct image * postimage ,
2389- unsigned long try ,
2390- int try_lno ,
2389+ unsigned long current ,
2390+ int current_lno ,
23912391 int preimage_limit )
23922392{
23932393 int i ;
@@ -2404,9 +2404,9 @@ static int line_by_line_fuzzy_match(struct image *img,
24042404
24052405 for (i = 0 ; i < preimage_limit ; i ++ ) {
24062406 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 ;
24082408
2409- if (!fuzzy_matchlines (img -> buf + try + imgoff , imglen ,
2409+ if (!fuzzy_matchlines (img -> buf + current + imgoff , imglen ,
24102410 preimage -> buf + preoff , prelen ))
24112411 return 0 ;
24122412 if (preimage -> line [i ].flag & LINE_COMMON )
@@ -2443,7 +2443,7 @@ static int line_by_line_fuzzy_match(struct image *img,
24432443 */
24442444 extra_chars = preimage_end - preimage_eof ;
24452445 strbuf_init (& fixed , imgoff + extra_chars );
2446- strbuf_add (& fixed , img -> buf + try , imgoff );
2446+ strbuf_add (& fixed , img -> buf + current , imgoff );
24472447 strbuf_add (& fixed , preimage_eof , extra_chars );
24482448 fixed_buf = strbuf_detach (& fixed , & fixed_len );
24492449 update_pre_post_images (preimage , postimage ,
@@ -2455,8 +2455,8 @@ static int match_fragment(struct apply_state *state,
24552455 struct image * img ,
24562456 struct image * preimage ,
24572457 struct image * postimage ,
2458- unsigned long try ,
2459- int try_lno ,
2458+ unsigned long current ,
2459+ int current_lno ,
24602460 unsigned ws_rule ,
24612461 int match_beginning , int match_end )
24622462{
@@ -2466,12 +2466,12 @@ static int match_fragment(struct apply_state *state,
24662466 size_t fixed_len , postlen ;
24672467 int preimage_limit ;
24682468
2469- if (preimage -> nr + try_lno <= img -> nr ) {
2469+ if (preimage -> nr + current_lno <= img -> nr ) {
24702470 /*
24712471 * The hunk falls within the boundaries of img.
24722472 */
24732473 preimage_limit = preimage -> nr ;
2474- if (match_end && (preimage -> nr + try_lno != img -> nr ))
2474+ if (match_end && (preimage -> nr + current_lno != img -> nr ))
24752475 return 0 ;
24762476 } else if (state -> ws_error_action == correct_ws_error &&
24772477 (ws_rule & WS_BLANK_AT_EOF )) {
@@ -2482,7 +2482,7 @@ static int match_fragment(struct apply_state *state,
24822482 * match with img, and the remainder of the preimage
24832483 * must be blank.
24842484 */
2485- preimage_limit = img -> nr - try_lno ;
2485+ preimage_limit = img -> nr - current_lno ;
24862486 } else {
24872487 /*
24882488 * The hunk extends beyond the end of the img and
@@ -2492,27 +2492,27 @@ static int match_fragment(struct apply_state *state,
24922492 return 0 ;
24932493 }
24942494
2495- if (match_beginning && try_lno )
2495+ if (match_beginning && current_lno )
24962496 return 0 ;
24972497
24982498 /* Quick hash check */
24992499 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 ))
25022502 return 0 ;
25032503
25042504 if (preimage_limit == preimage -> nr ) {
25052505 /*
25062506 * 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,
25092509 * and either case, the old piece should match the preimage
25102510 * exactly.
25112511 */
25122512 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 ))
25162516 return 1 ;
25172517 } else {
25182518 /*
@@ -2543,7 +2543,7 @@ static int match_fragment(struct apply_state *state,
25432543 */
25442544 if (state -> ws_ignore_action == ignore_ws_change )
25452545 return line_by_line_fuzzy_match (img , preimage , postimage ,
2546- try , try_lno , preimage_limit );
2546+ current , current_lno , preimage_limit );
25472547
25482548 if (state -> ws_error_action != correct_ws_error )
25492549 return 0 ;
@@ -2577,10 +2577,10 @@ static int match_fragment(struct apply_state *state,
25772577 */
25782578 strbuf_init (& fixed , preimage -> len + 1 );
25792579 orig = preimage -> buf ;
2580- target = img -> buf + try ;
2580+ target = img -> buf + current ;
25812581 for (i = 0 ; i < preimage_limit ; i ++ ) {
25822582 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 ;
25842584 size_t fixstart = fixed .len ;
25852585 struct strbuf tgtfix ;
25862586 int match ;
@@ -2666,8 +2666,8 @@ static int find_pos(struct apply_state *state,
26662666 int match_beginning , int match_end )
26672667{
26682668 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 ;
26712671
26722672 /*
26732673 * If match_beginning or match_end is specified, there is no
@@ -2687,25 +2687,25 @@ static int find_pos(struct apply_state *state,
26872687 if ((size_t ) line > img -> nr )
26882688 line = img -> nr ;
26892689
2690- try = 0 ;
2690+ current = 0 ;
26912691 for (i = 0 ; i < line ; i ++ )
2692- try += img -> line [i ].len ;
2692+ current += img -> line [i ].len ;
26932693
26942694 /*
26952695 * There's probably some smart way to do this, but I'll leave
26962696 * that to the smart and beautiful people. I'm simple and stupid.
26972697 */
2698- backwards = try ;
2698+ backwards = current ;
26992699 backwards_lno = line ;
2700- forwards = try ;
2700+ forwards = current ;
27012701 forwards_lno = line ;
2702- try_lno = line ;
2702+ current_lno = line ;
27032703
27042704 for (i = 0 ; ; i ++ ) {
27052705 if (match_fragment (state , img , preimage , postimage ,
2706- try , try_lno , ws_rule ,
2706+ current , current_lno , ws_rule ,
27072707 match_beginning , match_end ))
2708- return try_lno ;
2708+ return current_lno ;
27092709
27102710 again :
27112711 if (backwards_lno == 0 && forwards_lno == img -> nr )
@@ -2718,17 +2718,17 @@ static int find_pos(struct apply_state *state,
27182718 }
27192719 backwards_lno -- ;
27202720 backwards -= img -> line [backwards_lno ].len ;
2721- try = backwards ;
2722- try_lno = backwards_lno ;
2721+ current = backwards ;
2722+ current_lno = backwards_lno ;
27232723 } else {
27242724 if (forwards_lno == img -> nr ) {
27252725 i ++ ;
27262726 goto again ;
27272727 }
27282728 forwards += img -> line [forwards_lno ].len ;
27292729 forwards_lno ++ ;
2730- try = forwards ;
2731- try_lno = forwards_lno ;
2730+ current = forwards ;
2731+ current_lno = forwards_lno ;
27322732 }
27332733
27342734 }
@@ -4163,30 +4163,30 @@ static void show_mode_change(struct patch *p, int show_name)
41634163static void show_rename_copy (struct patch * p )
41644164{
41654165 const char * renamecopy = p -> is_rename ? "rename" : "copy" ;
4166- const char * old , * new ;
4166+ const char * old_name , * new_name ;
41674167
41684168 /* 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 ;
41714171 while (1 ) {
41724172 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 , '/' );
41754175 if (!slash_old ||
41764176 !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 ))
41794179 break ;
4180- old = slash_old + 1 ;
4181- new = slash_new + 1 ;
4180+ old_name = slash_old + 1 ;
4181+ new_name = slash_new + 1 ;
41824182 }
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
41844184 * through the end of names are renames
41854185 */
4186- if (old != p -> old_name )
4186+ if (old_name != p -> old_name )
41874187 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 );
41904190 else
41914191 printf (" %s %s => %s (%d%%)\n" , renamecopy ,
41924192 p -> old_name , p -> new_name , p -> score );
0 commit comments