builtin/apply: avoid local variable shadowing 'len' parameter

This is just a cleanup to avoid errors when compiling with -Wshadow and to make it safer to later move global variables into a "state" struct. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed May 11, 2016 at 15:16 UTC bb0ba9974314da72bba9a6200fa3bd61c4d9eab4
1 file changed +10 -10
builtin/apply.c
+10 -10
@@ -2194,17 +2194,17 @@ static void update_pre_post_images(struct image *preimage,
2194 fixed = preimage->buf;
2195
2196 for (i = reduced = ctx = 0; i < postimage->nr; i++) {
2197 - size_t len = postimage->line[i].len;
2197 + size_t l_len = postimage->line[i].len;
2198 if (!(postimage->line[i].flag & LINE_COMMON)) {
2199 /* an added line -- no counterparts in preimage */
2200 - memmove(new, old, len);
2201 - old += len;
2202 - new += len;
2200 + memmove(new, old, l_len);
2201 + old += l_len;
2202 + new += l_len;
2203 continue;
2204 }
2205
2206 /* a common context -- skip it in the original postimage */
2207 - old += len;
2207 + old += l_len;
2208
2209 /* and find the corresponding one in the fixed preimage */
2210 while (ctx < preimage->nr &&
@@ -2223,11 +2223,11 @@ static void update_pre_post_images(struct image *preimage,
2223 }
2224
2225 /* and copy it in, while fixing the line length */
2226 - len = preimage->line[ctx].len;
2227 - memcpy(new, fixed, len);
2228 - new += len;
2229 - fixed += len;
2230 - postimage->line[i].len = len;
2226 + l_len = preimage->line[ctx].len;
2227 + memcpy(new, fixed, l_len);
2228 + new += l_len;
2229 + fixed += l_len;
2230 + postimage->line[i].len = l_len;
2231 ctx++;
2232 }
2233