summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorLibravatar Christian Couder <christian.couder@gmail.com>2016-05-11 15:16:15 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-05-12 12:11:14 -0700
commitbb0ba9974314da72bba9a6200fa3bd61c4d9eab4 (patch)
tree90061a221b9f1fb5968d6b3b6a307fc78a9ef24c /builtin/apply.c
parentbuiltin/apply: avoid parameter shadowing 'linenr' global (diff)
downloadtgif-bb0ba9974314da72bba9a6200fa3bd61c4d9eab4.tar.xz
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>
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 705a9c8bd1..bb8bf7f0e3 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -2194,17 +2194,17 @@ static void update_pre_post_images(struct image *preimage,
fixed = preimage->buf;
for (i = reduced = ctx = 0; i < postimage->nr; i++) {
- size_t len = postimage->line[i].len;
+ size_t l_len = postimage->line[i].len;
if (!(postimage->line[i].flag & LINE_COMMON)) {
/* an added line -- no counterparts in preimage */
- memmove(new, old, len);
- old += len;
- new += len;
+ memmove(new, old, l_len);
+ old += l_len;
+ new += l_len;
continue;
}
/* a common context -- skip it in the original postimage */
- old += len;
+ old += l_len;
/* and find the corresponding one in the fixed preimage */
while (ctx < preimage->nr &&
@@ -2223,11 +2223,11 @@ static void update_pre_post_images(struct image *preimage,
}
/* and copy it in, while fixing the line length */
- len = preimage->line[ctx].len;
- memcpy(new, fixed, len);
- new += len;
- fixed += len;
- postimage->line[i].len = len;
+ l_len = preimage->line[ctx].len;
+ memcpy(new, fixed, l_len);
+ new += l_len;
+ fixed += l_len;
+ postimage->line[i].len = l_len;
ctx++;
}