apply: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able to be compiled with a C++ compiler. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Feb 14, 2018 at 10:59 UTC f1ae97d3332fea1b34dad67c8c932abf9eb2332e
1 file changed +27 -27
apply.c
+27 -27
@@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,
2301 size_t len, size_t postlen)
2302 {
2303 int i, ctx, reduced;
2304 - char *new, *old, *fixed;
2304 + char *new_buf, *old_buf, *fixed;
2305 struct image fixed_preimage;
2306
2307 /*
@@ -2327,25 +2327,25 @@ static void update_pre_post_images(struct image *preimage,
2327 * We trust the caller to tell us if the update can be done
2328 * in place (postlen==0) or not.
2329 */
2330 - old = postimage->buf;
2330 + old_buf = postimage->buf;
2331 if (postlen)
2332 - new = postimage->buf = xmalloc(postlen);
2332 + new_buf = postimage->buf = xmalloc(postlen);
2333 else
2334 - new = old;
2334 + new_buf = old_buf;
2335 fixed = preimage->buf;
2336
2337 for (i = reduced = ctx = 0; i < postimage->nr; i++) {
2338 size_t l_len = postimage->line[i].len;
2339 if (!(postimage->line[i].flag & LINE_COMMON)) {
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 continue;
2345 }
2346
2347 /* a common context -- skip it in the original postimage */
2348 - old += l_len;
2348 + old_buf += l_len;
2349
2350 /* and find the corresponding one in the fixed preimage */
2351 while (ctx < preimage->nr &&
@@ -2365,21 +2365,21 @@ static void update_pre_post_images(struct image *preimage,
2365
2366 /* and copy it in, while fixing the line length */
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 fixed += l_len;
2371 postimage->line[i].len = l_len;
2372 ctx++;
2373 }
2374
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 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
2381 /* Fix the length of the whole thing */
2382 - postimage->len = new - postimage->buf;
2382 + postimage->len = new_buf - postimage->buf;
2383 postimage->nr -= reduced;
2384 }
2385
@@ -4163,30 +4163,30 @@ static void show_mode_change(struct patch *p, int show_name)
4163 static void show_rename_copy(struct patch *p)
4164 {
4165 const char *renamecopy = p->is_rename ? "rename" : "copy";
4166 - const char *old, *new;
4166 + const char *old_name, *new_name;
4167
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 while (1) {
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 if (!slash_old ||
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 break;
4180 - old = slash_old + 1;
4181 - new = slash_new + 1;
4180 + old_name = slash_old + 1;
4181 + new_name = slash_new + 1;
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 * through the end of names are renames
4185 */
4186 - if (old != p->old_name)
4186 + if (old_name != p->old_name)
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 else
4191 printf(" %s %s => %s (%d%%)\n", renamecopy,
4192 p->old_name, p->new_name, p->score);