git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: j6t@kdbg.org, avarab@gmail.com, Brandon Williams <bmwill@google.com>
Subject: [PATCH 19/37] entry: rename 'new' variables
Date: Mon, 29 Jan 2018 14:37:10 -0800	[thread overview]
Message-ID: <20180129223728.30569-20-bmwill@google.com> (raw)
In-Reply-To: <20180129223728.30569-1-bmwill@google.com>

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>
---
 entry.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/entry.c b/entry.c
index 30211447a..6c33112ae 100644
--- a/entry.c
+++ b/entry.c
@@ -85,12 +85,12 @@ static int create_file(const char *path, unsigned int mode)
 static void *read_blob_entry(const struct cache_entry *ce, unsigned long *size)
 {
 	enum object_type type;
-	void *new = read_sha1_file(ce->oid.hash, &type, size);
+	void *blob_data = read_sha1_file(ce->oid.hash, &type, size);
 
-	if (new) {
+	if (blob_data) {
 		if (type == OBJ_BLOB)
-			return new;
-		free(new);
+			return blob_data;
+		free(blob_data);
 	}
 	return NULL;
 }
@@ -256,7 +256,7 @@ static int write_entry(struct cache_entry *ce,
 	unsigned int ce_mode_s_ifmt = ce->ce_mode & S_IFMT;
 	struct delayed_checkout *dco = state->delayed_checkout;
 	int fd, ret, fstat_done = 0;
-	char *new;
+	char *new_blob;
 	struct strbuf buf = STRBUF_INIT;
 	unsigned long size;
 	ssize_t wrote;
@@ -276,8 +276,8 @@ static int write_entry(struct cache_entry *ce,
 
 	switch (ce_mode_s_ifmt) {
 	case S_IFLNK:
-		new = read_blob_entry(ce, &size);
-		if (!new)
+		new_blob = read_blob_entry(ce, &size);
+		if (!new_blob)
 			return error("unable to read sha1 file of %s (%s)",
 				     path, oid_to_hex(&ce->oid));
 
@@ -288,8 +288,8 @@ static int write_entry(struct cache_entry *ce,
 		if (!has_symlinks || to_tempfile)
 			goto write_file_entry;
 
-		ret = symlink(new, path);
-		free(new);
+		ret = symlink(new_blob, path);
+		free(new_blob);
 		if (ret)
 			return error_errno("unable to create symlink %s", path);
 		break;
@@ -300,11 +300,11 @@ static int write_entry(struct cache_entry *ce,
 		 * bother reading it at all.
 		 */
 		if (dco && dco->state == CE_RETRY) {
-			new = NULL;
+			new_blob = NULL;
 			size = 0;
 		} else {
-			new = read_blob_entry(ce, &size);
-			if (!new)
+			new_blob = read_blob_entry(ce, &size);
+			if (!new_blob)
 				return error("unable to read sha1 file of %s (%s)",
 					     path, oid_to_hex(&ce->oid));
 		}
@@ -313,18 +313,18 @@ static int write_entry(struct cache_entry *ce,
 		 * Convert from git internal format to working tree format
 		 */
 		if (dco && dco->state != CE_NO_DELAY) {
-			ret = async_convert_to_working_tree(ce->name, new,
+			ret = async_convert_to_working_tree(ce->name, new_blob,
 							    size, &buf, dco);
 			if (ret && string_list_has_string(&dco->paths, ce->name)) {
-				free(new);
+				free(new_blob);
 				goto delayed;
 			}
 		} else
-			ret = convert_to_working_tree(ce->name, new, size, &buf);
+			ret = convert_to_working_tree(ce->name, new_blob, size, &buf);
 
 		if (ret) {
-			free(new);
-			new = strbuf_detach(&buf, &newsize);
+			free(new_blob);
+			new_blob = strbuf_detach(&buf, &newsize);
 			size = newsize;
 		}
 		/*
@@ -336,15 +336,15 @@ static int write_entry(struct cache_entry *ce,
 	write_file_entry:
 		fd = open_output_fd(path, ce, to_tempfile);
 		if (fd < 0) {
-			free(new);
+			free(new_blob);
 			return error_errno("unable to create file %s", path);
 		}
 
-		wrote = write_in_full(fd, new, size);
+		wrote = write_in_full(fd, new_blob, size);
 		if (!to_tempfile)
 			fstat_done = fstat_output(fd, state, &st);
 		close(fd);
-		free(new);
+		free(new_blob);
 		if (wrote < 0)
 			return error("unable to write file %s", path);
 		break;
-- 
2.16.0.rc1.238.g530d649a79-goog


  parent reply	other threads:[~2018-01-29 22:38 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
2018-01-29 22:36 ` [PATCH 01/37] object_info: change member name from 'typename' to 'type_name' Brandon Williams
2018-01-29 22:36 ` [PATCH 02/37] object: rename function " Brandon Williams
2018-01-29 22:36 ` [PATCH 03/37] blame: rename 'this' variables Brandon Williams
2018-01-29 22:36 ` [PATCH 04/37] pack-objects: " Brandon Williams
2018-01-29 22:36 ` [PATCH 05/37] rev-parse: rename 'this' variable Brandon Williams
2018-01-29 22:36 ` [PATCH 06/37] diff: rename 'this' variables Brandon Williams
2018-01-29 22:36 ` [PATCH 07/37] apply: rename 'try' variables Brandon Williams
2018-01-29 22:36 ` [PATCH 08/37] apply: rename 'new' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 09/37] checkout: " Brandon Williams
2018-01-29 22:37 ` [PATCH 10/37] help: " Brandon Williams
2018-01-29 22:37 ` [PATCH 11/37] pack-redundant: " Brandon Williams
2018-01-29 22:37 ` [PATCH 12/37] reflog: " Brandon Williams
2018-01-29 22:37 ` [PATCH 13/37] remote: " Brandon Williams
2018-01-29 22:37 ` [PATCH 14/37] combine-diff: " Brandon Williams
2018-01-29 22:37 ` [PATCH 15/37] commit: " Brandon Williams
2018-01-29 22:37 ` [PATCH 16/37] diff-lib: rename 'new' variable Brandon Williams
2018-01-29 22:37 ` [PATCH 17/37] diff: rename 'new' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 18/37] diffcore-delta: " Brandon Williams
2018-01-29 22:37 ` Brandon Williams [this message]
2018-01-29 22:37 ` [PATCH 20/37] http: " Brandon Williams
2018-01-29 22:37 ` [PATCH 21/37] imap-send: " Brandon Williams
2018-01-29 22:37 ` [PATCH 22/37] line-log: " Brandon Williams
2018-01-29 22:37 ` [PATCH 23/37] read-cache: " Brandon Williams
2018-01-29 22:37 ` [PATCH 24/37] ref-filter: " Brandon Williams
2018-01-29 22:37 ` [PATCH 25/37] remote: " Brandon Williams
2018-01-29 22:37 ` [PATCH 26/37] split-index: " Brandon Williams
2018-01-29 22:37 ` [PATCH 27/37] submodule: " Brandon Williams
2018-01-29 22:37 ` [PATCH 28/37] trailer: " Brandon Williams
2018-01-29 22:37 ` [PATCH 29/37] unpack-trees: " Brandon Williams
2018-01-29 22:37 ` [PATCH 30/37] init-db: rename 'template' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 31/37] environment: " Brandon Williams
2018-01-29 22:37 ` [PATCH 32/37] diff: " Brandon Williams
2018-01-29 22:37 ` [PATCH 33/37] environment: rename 'namespace' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 34/37] wrapper: rename 'template' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 35/37] tempfile: " Brandon Williams
2018-01-29 22:37 ` [PATCH 36/37] trailer: " Brandon Williams
2018-01-29 22:37 ` [PATCH 37/37] replace: rename 'new' variables Brandon Williams
2018-01-30 22:58   ` Stefan Beller
2018-01-30 23:21     ` Junio C Hamano
2018-01-30  0:13 ` [PATCH 00/37] removal of some c++ keywords Duy Nguyen
2018-01-30 22:36   ` Junio C Hamano
2018-01-30 23:01     ` Stefan Beller
2018-01-31  0:48       ` Duy Nguyen
2018-01-31  0:57         ` Stefan Beller
2018-01-31  1:05           ` Duy Nguyen
2018-01-30 20:54 ` Johannes Sixt
2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 01/37] object_info: change member name from 'typename' to 'type_name' Brandon Williams
2018-02-14 18:59   ` [PATCH v2 02/37] object: rename function " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 03/37] blame: rename 'this' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 04/37] pack-objects: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 05/37] rev-parse: rename 'this' variable Brandon Williams
2018-02-14 18:59   ` [PATCH v2 06/37] diff: rename 'this' variables Brandon Williams
2018-02-14 21:19     ` Junio C Hamano
2018-02-14 21:24       ` Brandon Williams
2018-02-14 18:59   ` [PATCH v2 07/37] apply: rename 'try' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 08/37] apply: rename 'new' variables Brandon Williams
2018-02-14 21:40     ` Stefan Beller
2018-02-14 18:59   ` [PATCH v2 09/37] checkout: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 10/37] help: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 11/37] pack-redundant: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 12/37] reflog: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 13/37] remote: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 14/37] combine-diff: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 15/37] commit: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 16/37] diff-lib: rename 'new' variable Brandon Williams
2018-02-14 18:59   ` [PATCH v2 17/37] diff: rename 'new' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 18/37] diffcore-delta: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 19/37] entry: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 20/37] http: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 21/37] imap-send: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 22/37] line-log: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 23/37] read-cache: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 24/37] ref-filter: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 25/37] remote: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 26/37] split-index: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 27/37] submodule: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 28/37] trailer: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 29/37] unpack-trees: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 30/37] init-db: rename 'template' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 31/37] environment: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 32/37] diff: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 33/37] environment: rename 'namespace' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 34/37] wrapper: rename 'template' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 35/37] tempfile: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 36/37] trailer: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 37/37] replace: rename 'new' variables Brandon Williams
2018-02-14 22:41   ` [PATCH v2 00/37] removal of some c++ keywords Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180129223728.30569-20-bmwill@google.com \
    --to=bmwill@google.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).