зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
eb8fdbff3c
Коммит
bb0ba99743
|
@ -2194,17 +2194,17 @@ static void update_pre_post_images(struct image *preimage,
|
||||||
fixed = preimage->buf;
|
fixed = preimage->buf;
|
||||||
|
|
||||||
for (i = reduced = ctx = 0; i < postimage->nr; i++) {
|
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)) {
|
if (!(postimage->line[i].flag & LINE_COMMON)) {
|
||||||
/* an added line -- no counterparts in preimage */
|
/* an added line -- no counterparts in preimage */
|
||||||
memmove(new, old, len);
|
memmove(new, old, l_len);
|
||||||
old += len;
|
old += l_len;
|
||||||
new += len;
|
new += l_len;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a common context -- skip it in the original postimage */
|
/* a common context -- skip it in the original postimage */
|
||||||
old += len;
|
old += l_len;
|
||||||
|
|
||||||
/* and find the corresponding one in the fixed preimage */
|
/* and find the corresponding one in the fixed preimage */
|
||||||
while (ctx < preimage->nr &&
|
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 */
|
/* and copy it in, while fixing the line length */
|
||||||
len = preimage->line[ctx].len;
|
l_len = preimage->line[ctx].len;
|
||||||
memcpy(new, fixed, len);
|
memcpy(new, fixed, l_len);
|
||||||
new += len;
|
new += l_len;
|
||||||
fixed += len;
|
fixed += l_len;
|
||||||
postimage->line[i].len = len;
|
postimage->line[i].len = l_len;
|
||||||
ctx++;
|
ctx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче