entry: 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 d8f71807c1d75a34f6f12050a9f307dfe9fdb29d
1 file changed +20 -20
entry.c
+20 -20
@@ -85,12 +85,12 @@ static int create_file(const char *path, unsigned int mode)
85 static void *read_blob_entry(const struct cache_entry *ce, unsigned long *size)
86 {
87 enum object_type type;
88 - void *new = read_sha1_file(ce->oid.hash, &type, size);
88 + void *blob_data = read_sha1_file(ce->oid.hash, &type, size);
89
90 - if (new) {
90 + if (blob_data) {
91 if (type == OBJ_BLOB)
92 - return new;
93 - free(new);
92 + return blob_data;
93 + free(blob_data);
94 }
95 return NULL;
96 }
@@ -256,7 +256,7 @@ static int write_entry(struct cache_entry *ce,
256 unsigned int ce_mode_s_ifmt = ce->ce_mode & S_IFMT;
257 struct delayed_checkout *dco = state->delayed_checkout;
258 int fd, ret, fstat_done = 0;
259 - char *new;
259 + char *new_blob;
260 struct strbuf buf = STRBUF_INIT;
261 unsigned long size;
262 ssize_t wrote;
@@ -276,8 +276,8 @@ static int write_entry(struct cache_entry *ce,
276
277 switch (ce_mode_s_ifmt) {
278 case S_IFLNK:
279 - new = read_blob_entry(ce, &size);
280 - if (!new)
279 + new_blob = read_blob_entry(ce, &size);
280 + if (!new_blob)
281 return error("unable to read sha1 file of %s (%s)",
282 path, oid_to_hex(&ce->oid));
283
@@ -288,8 +288,8 @@ static int write_entry(struct cache_entry *ce,
288 if (!has_symlinks || to_tempfile)
289 goto write_file_entry;
290
291 - ret = symlink(new, path);
292 - free(new);
291 + ret = symlink(new_blob, path);
292 + free(new_blob);
293 if (ret)
294 return error_errno("unable to create symlink %s", path);
295 break;
@@ -300,11 +300,11 @@ static int write_entry(struct cache_entry *ce,
300 * bother reading it at all.
301 */
302 if (dco && dco->state == CE_RETRY) {
303 - new = NULL;
303 + new_blob = NULL;
304 size = 0;
305 } else {
306 - new = read_blob_entry(ce, &size);
307 - if (!new)
306 + new_blob = read_blob_entry(ce, &size);
307 + if (!new_blob)
308 return error("unable to read sha1 file of %s (%s)",
309 path, oid_to_hex(&ce->oid));
310 }
@@ -313,18 +313,18 @@ static int write_entry(struct cache_entry *ce,
313 * Convert from git internal format to working tree format
314 */
315 if (dco && dco->state != CE_NO_DELAY) {
316 - ret = async_convert_to_working_tree(ce->name, new,
316 + ret = async_convert_to_working_tree(ce->name, new_blob,
317 size, &buf, dco);
318 if (ret && string_list_has_string(&dco->paths, ce->name)) {
319 - free(new);
319 + free(new_blob);
320 goto delayed;
321 }
322 } else
323 - ret = convert_to_working_tree(ce->name, new, size, &buf);
323 + ret = convert_to_working_tree(ce->name, new_blob, size, &buf);
324
325 if (ret) {
326 - free(new);
327 - new = strbuf_detach(&buf, &newsize);
326 + free(new_blob);
327 + new_blob = strbuf_detach(&buf, &newsize);
328 size = newsize;
329 }
330 /*
@@ -336,15 +336,15 @@ static int write_entry(struct cache_entry *ce,
336 write_file_entry:
337 fd = open_output_fd(path, ce, to_tempfile);
338 if (fd < 0) {
339 - free(new);
339 + free(new_blob);
340 return error_errno("unable to create file %s", path);
341 }
342
343 - wrote = write_in_full(fd, new, size);
343 + wrote = write_in_full(fd, new_blob, size);
344 if (!to_tempfile)
345 fstat_done = fstat_output(fd, state, &st);
346 close(fd);
347 - free(new);
347 + free(new_blob);
348 if (wrote < 0)
349 return error("unable to write file %s", path);
350 break;