git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 00/37] removal of some c++ keywords
@ 2018-01-29 22:36 Brandon Williams
  2018-01-29 22:36 ` [PATCH 01/37] object_info: change member name from 'typename' to 'type_name' Brandon Williams
                   ` (39 more replies)
  0 siblings, 40 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

A while back there was some discussion of getting our codebase into a state
where we could use a c++ compiler if we wanted to (for various reason like
leveraging c++ only analysis tools, etc.).  Johannes Sixt had a very large
patch that achieved this but it wasn't in a state where it could be upstreamed.
I took that idea and did some removals of c++ keywords (new, template, try,
this, etc) but broke it up into several (well maybe more than several) patches.
I don't believe I've captured all of them in this series but this is at least
moving a step closer to being able to compile using a c++ compiler.

I don't know if this is something the community still wants to move towards,
but if this is something people are still interested in, and this series is
wanted, then we can keep doing these sort of conversions in chunks slowly.

Brandon Williams (37):
  object_info: change member name from 'typename' to 'type_name'
  object: rename function 'typename' to 'type_name'
  blame: rename 'this' variables
  pack-objects: rename 'this' variables
  rev-parse: rename 'this' variable
  diff: rename 'this' variables
  apply: rename 'try' variables
  apply: rename 'new' variables
  checkout: rename 'new' variables
  help: rename 'new' variables
  pack-redundant: rename 'new' variables
  reflog: rename 'new' variables
  remote: rename 'new' variables
  combine-diff: rename 'new' variables
  commit: rename 'new' variables
  diff-lib: rename 'new' variable
  diff: rename 'new' variables
  diffcore-delta: rename 'new' variables
  entry: rename 'new' variables
  http: rename 'new' variables
  imap-send: rename 'new' variables
  line-log: rename 'new' variables
  read-cache: rename 'new' variables
  ref-filter: rename 'new' variables
  remote: rename 'new' variables
  split-index: rename 'new' variables
  submodule: rename 'new' variables
  trailer: rename 'new' variables
  unpack-trees: rename 'new' variables
  init-db: rename 'template' variables
  environment: rename 'template' variables
  diff: rename 'template' variables
  environment: rename 'namespace' variables
  wrapper: rename 'template' variables
  tempfile: rename 'template' variables
  trailer: rename 'template' variables
  replace: rename 'new' variables

 apply.c                                | 106 ++++++++++++-------------
 blame.c                                |  33 ++++----
 builtin/cat-file.c                     |   4 +-
 builtin/checkout.c                     | 138 ++++++++++++++++-----------------
 builtin/diff-tree.c                    |   2 +-
 builtin/fast-export.c                  |   8 +-
 builtin/fsck.c                         |   4 +-
 builtin/grep.c                         |   2 +-
 builtin/help.c                         |  10 +--
 builtin/index-pack.c                   |  12 +--
 builtin/init-db.c                      |  30 +++----
 builtin/merge.c                        |   2 +-
 builtin/mktree.c                       |   4 +-
 builtin/pack-objects.c                 |   8 +-
 builtin/pack-redundant.c               |  48 ++++++------
 builtin/prune.c                        |   2 +-
 builtin/reflog.c                       |   8 +-
 builtin/remote.c                       |  44 +++++------
 builtin/replace.c                      |  28 +++----
 builtin/rev-parse.c                    |  34 ++++----
 builtin/tag.c                          |   2 +-
 builtin/unpack-objects.c               |  10 +--
 builtin/verify-commit.c                |   2 +-
 bulk-checkin.c                         |   2 +-
 cache.h                                |   4 +-
 combine-diff.c                         |  12 +--
 commit.c                               |  20 ++---
 contrib/examples/builtin-fetch--tool.c |   2 +-
 diff-lib.c                             |  20 ++---
 diff.c                                 |  38 ++++-----
 diffcore-delta.c                       |  16 ++--
 entry.c                                |  40 +++++-----
 environment.c                          |  24 +++---
 fast-import.c                          |  16 ++--
 fsck.c                                 |   2 +-
 git-compat-util.h                      |   4 +-
 http-push.c                            |   2 +-
 http.c                                 |  10 +--
 imap-send.c                            |  14 ++--
 line-log.c                             |  48 ++++++------
 log-tree.c                             |   2 +-
 object.c                               |   6 +-
 object.h                               |   2 +-
 pack-check.c                           |   2 +-
 packfile.c                             |   8 +-
 reachable.c                            |   2 +-
 read-cache.c                           |  36 ++++-----
 ref-filter.c                           |  20 ++---
 remote.c                               |  16 ++--
 sequencer.c                            |   2 +-
 sha1_file.c                            |  28 +++----
 sha1_name.c                            |   6 +-
 split-index.c                          |  10 +--
 split-index.h                          |   2 +-
 submodule.c                            |  16 ++--
 submodule.h                            |   2 +-
 tag.c                                  |   2 +-
 tempfile.c                             |  12 +--
 tempfile.h                             |  34 ++++----
 trailer.c                              |  44 +++++------
 unpack-trees.c                         |   6 +-
 walker.c                               |   4 +-
 wrapper.c                              |  40 +++++-----
 63 files changed, 559 insertions(+), 558 deletions(-)

-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply	[flat|nested] 89+ messages in thread

* [PATCH 01/37] object_info: change member name from 'typename' to 'type_name'
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
@ 2018-01-29 22:36 ` Brandon Williams
  2018-01-29 22:36 ` [PATCH 02/37] object: rename function " Brandon Williams
                   ` (38 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/cat-file.c |  2 +-
 cache.h            |  2 +-
 packfile.c         |  6 +++---
 sha1_file.c        | 10 +++++-----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index f5fa4fd75..d06c66c77 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -76,7 +76,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
 	buf = NULL;
 	switch (opt) {
 	case 't':
-		oi.typename = &sb;
+		oi.type_name = &sb;
 		if (sha1_object_info_extended(oid.hash, &oi, flags) < 0)
 			die("git cat-file: could not get object info");
 		if (sb.len) {
diff --git a/cache.h b/cache.h
index d8b975a57..69b5a3bf8 100644
--- a/cache.h
+++ b/cache.h
@@ -1744,7 +1744,7 @@ struct object_info {
 	unsigned long *sizep;
 	off_t *disk_sizep;
 	unsigned char *delta_base_sha1;
-	struct strbuf *typename;
+	struct strbuf *type_name;
 	void **contentp;
 
 	/* Response */
diff --git a/packfile.c b/packfile.c
index 4a5fe7ab1..6657a0a49 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1350,16 +1350,16 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
 		*oi->disk_sizep = revidx[1].offset - obj_offset;
 	}
 
-	if (oi->typep || oi->typename) {
+	if (oi->typep || oi->type_name) {
 		enum object_type ptot;
 		ptot = packed_to_object_type(p, obj_offset, type, &w_curs,
 					     curpos);
 		if (oi->typep)
 			*oi->typep = ptot;
-		if (oi->typename) {
+		if (oi->type_name) {
 			const char *tn = typename(ptot);
 			if (tn)
-				strbuf_addstr(oi->typename, tn);
+				strbuf_addstr(oi->type_name, tn);
 		}
 		if (ptot < 0) {
 			type = OBJ_BAD;
diff --git a/sha1_file.c b/sha1_file.c
index 3da70ac65..2c03458ea 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1087,8 +1087,8 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,
 	}
 
 	type = type_from_string_gently(type_buf, type_len, 1);
-	if (oi->typename)
-		strbuf_add(oi->typename, type_buf, type_len);
+	if (oi->type_name)
+		strbuf_add(oi->type_name, type_buf, type_len);
 	/*
 	 * Set type to 0 if its an unknown object and
 	 * we're obtaining the type using '--allow-unknown-type'
@@ -1158,7 +1158,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,
 	 * return value implicitly indicates whether the
 	 * object even exists.
 	 */
-	if (!oi->typep && !oi->typename && !oi->sizep && !oi->contentp) {
+	if (!oi->typep && !oi->type_name && !oi->sizep && !oi->contentp) {
 		const char *path;
 		struct stat st;
 		if (stat_sha1_file(sha1, &st, &path) < 0)
@@ -1239,8 +1239,8 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
 				*(oi->disk_sizep) = 0;
 			if (oi->delta_base_sha1)
 				hashclr(oi->delta_base_sha1);
-			if (oi->typename)
-				strbuf_addstr(oi->typename, typename(co->type));
+			if (oi->type_name)
+				strbuf_addstr(oi->type_name, typename(co->type));
 			if (oi->contentp)
 				*oi->contentp = xmemdupz(co->buf, co->size);
 			oi->whence = OI_CACHED;
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 02/37] object: rename function 'typename' to 'type_name'
  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 ` Brandon Williams
  2018-01-29 22:36 ` [PATCH 03/37] blame: rename 'this' variables Brandon Williams
                   ` (37 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/cat-file.c                     |  2 +-
 builtin/diff-tree.c                    |  2 +-
 builtin/fast-export.c                  |  8 ++++----
 builtin/fsck.c                         |  4 ++--
 builtin/grep.c                         |  2 +-
 builtin/index-pack.c                   | 12 ++++++------
 builtin/merge.c                        |  2 +-
 builtin/mktree.c                       |  4 ++--
 builtin/prune.c                        |  2 +-
 builtin/replace.c                      | 12 ++++++------
 builtin/tag.c                          |  2 +-
 builtin/unpack-objects.c               | 10 +++++-----
 builtin/verify-commit.c                |  2 +-
 bulk-checkin.c                         |  2 +-
 commit.c                               |  2 +-
 contrib/examples/builtin-fetch--tool.c |  2 +-
 fast-import.c                          | 16 ++++++++--------
 fsck.c                                 |  2 +-
 http-push.c                            |  2 +-
 log-tree.c                             |  2 +-
 object.c                               |  6 +++---
 object.h                               |  2 +-
 pack-check.c                           |  2 +-
 packfile.c                             |  2 +-
 reachable.c                            |  2 +-
 ref-filter.c                           |  4 ++--
 sequencer.c                            |  2 +-
 sha1_file.c                            | 20 ++++++++++----------
 sha1_name.c                            |  6 +++---
 submodule.c                            |  2 +-
 tag.c                                  |  2 +-
 walker.c                               |  4 ++--
 32 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index d06c66c77..c6b3b1bfb 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -229,7 +229,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
 		if (data->mark_query)
 			data->info.typep = &data->type;
 		else
-			strbuf_addstr(sb, typename(data->type));
+			strbuf_addstr(sb, type_name(data->type));
 	} else if (is_atom("objectsize", atom, len)) {
 		if (data->mark_query)
 			data->info.sizep = &data->size;
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index b775a7564..473615117 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -76,7 +76,7 @@ static int diff_tree_stdin(char *line)
 	if (obj->type == OBJ_TREE)
 		return stdin_diff_trees((struct tree *)obj, p);
 	error("Object %s is a %s, not a commit or tree",
-	      oid_to_hex(&oid), typename(obj->type));
+	      oid_to_hex(&oid), type_name(obj->type));
 	return -1;
 }
 
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 796d0cd66..27b2cc138 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid)
 		buf = read_sha1_file(oid->hash, &type, &size);
 		if (!buf)
 			die ("Could not read blob %s", oid_to_hex(oid));
-		if (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)
+		if (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0)
 			die("sha1 mismatch in blob %s", oid_to_hex(oid));
 		object = parse_object_buffer(oid, type, size, buf, &eaten);
 	}
@@ -757,7 +757,7 @@ static void handle_tag(const char *name, struct tag *tag)
 			if (tagged->type != OBJ_COMMIT) {
 				die ("Tag %s tags unexported %s!",
 				     oid_to_hex(&tag->object.oid),
-				     typename(tagged->type));
+				     type_name(tagged->type));
 			}
 			p = (struct commit *)tagged;
 			for (;;) {
@@ -839,7 +839,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
 		if (!commit) {
 			warning("%s: Unexpected object of type %s, skipping.",
 				e->name,
-				typename(e->item->type));
+				type_name(e->item->type));
 			continue;
 		}
 
@@ -851,7 +851,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
 			continue;
 		default: /* OBJ_TAG (nested tags) is already handled */
 			warning("Tag points to object of unexpected type %s, skipping.",
-				typename(commit->object.type));
+				type_name(commit->object.type));
 			continue;
 		}
 
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 04846d46f..246237e81 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -70,7 +70,7 @@ static const char *printable_type(struct object *obj)
 			object_as_type(obj, type, 0);
 	}
 
-	ret = typename(obj->type);
+	ret = type_name(obj->type);
 	if (!ret)
 		ret = "unknown";
 
@@ -137,7 +137,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt
 		printf("broken link from %7s %s\n",
 			   printable_type(parent), describe_object(parent));
 		printf("broken link from %7s %s\n",
-			   (type == OBJ_ANY ? "unknown" : typename(type)), "unknown");
+			   (type == OBJ_ANY ? "unknown" : type_name(type)), "unknown");
 		errors_found |= ERROR_REACHABLE;
 		return 1;
 	}
diff --git a/builtin/grep.c b/builtin/grep.c
index 3ca4ac80d..eb1207095 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -627,7 +627,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
 		free(data);
 		return hit;
 	}
-	die(_("unable to grep from object of type %s"), typename(obj->type));
+	die(_("unable to grep from object of type %s"), type_name(obj->type));
 }
 
 static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 4c51aec81..8b87090e2 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -228,7 +228,7 @@ static unsigned check_object(struct object *obj)
 		if (type != obj->type)
 			die(_("object %s: expected type %s, found %s"),
 			    oid_to_hex(&obj->oid),
-			    typename(obj->type), typename(type));
+			    type_name(obj->type), type_name(type));
 		obj->flags |= FLAG_CHECKED;
 		return 1;
 	}
@@ -448,7 +448,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
 	int hdrlen;
 
 	if (!is_delta_type(type)) {
-		hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
+		hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), size) + 1;
 		git_SHA1_Init(&c);
 		git_SHA1_Update(&c, hdr, hdrlen);
 	} else
@@ -849,7 +849,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
 			obj = parse_object_buffer(oid, type, size, buf,
 						  &eaten);
 			if (!obj)
-				die(_("invalid %s"), typename(type));
+				die(_("invalid %s"), type_name(type));
 			if (do_fsck_object &&
 			    fsck_object(obj, buf, size, &fsck_options))
 				die(_("Error in object"));
@@ -959,7 +959,7 @@ static void resolve_delta(struct object_entry *delta_obj,
 	if (!result->data)
 		bad_object(delta_obj->idx.offset, _("failed to apply delta"));
 	hash_sha1_file(result->data, result->size,
-		       typename(delta_obj->real_type),
+		       type_name(delta_obj->real_type),
 		       delta_obj->idx.oid.hash);
 	sha1_object(result->data, NULL, result->size, delta_obj->real_type,
 		    &delta_obj->idx.oid);
@@ -1379,7 +1379,7 @@ static void fix_unresolved_deltas(struct sha1file *f)
 			continue;
 
 		if (check_sha1_signature(d->sha1, base_obj->data,
-				base_obj->size, typename(type)))
+				base_obj->size, type_name(type)))
 			die(_("local object %s is corrupt"), sha1_to_hex(d->sha1));
 		base_obj->obj = append_obj_to_pack(f, d->sha1,
 					base_obj->data, base_obj->size, type);
@@ -1588,7 +1588,7 @@ static void show_pack_info(int stat_only)
 			continue;
 		printf("%s %-6s %lu %lu %"PRIuMAX,
 		       oid_to_hex(&obj->idx.oid),
-		       typename(obj->real_type), obj->size,
+		       type_name(obj->real_type), obj->size,
 		       (unsigned long)(obj[1].idx.offset - obj->idx.offset),
 		       (uintmax_t)obj->idx.offset);
 		if (is_delta_type(obj->type)) {
diff --git a/builtin/merge.c b/builtin/merge.c
index 30264cfd7..9dec14096 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -520,7 +520,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
 		if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
 			strbuf_addf(msg, "%s\t\t%s '%s'\n",
 				    oid_to_hex(&desc->obj->oid),
-				    typename(desc->obj->type),
+				    type_name(desc->obj->type),
 				    remote);
 			goto cleanup;
 		}
diff --git a/builtin/mktree.c b/builtin/mktree.c
index da0fd8cd7..b7b1cb51f 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -112,7 +112,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
 	mode_type = object_type(mode);
 	if (mode_type != type_from_string(ptr)) {
 		die("entry '%s' object type (%s) doesn't match mode type (%s)",
-			path, ptr, typename(mode_type));
+			path, ptr, type_name(mode_type));
 	}
 
 	/* Check the type of object identified by sha1 */
@@ -131,7 +131,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
 			 * because the new tree entry will never be correct.
 			 */
 			die("entry '%s' object %s is a %s but specified type was (%s)",
-				path, sha1_to_hex(sha1), typename(obj_type), typename(mode_type));
+				path, sha1_to_hex(sha1), type_name(obj_type), type_name(mode_type));
 		}
 	}
 
diff --git a/builtin/prune.c b/builtin/prune.c
index d2fdae680..c175f154e 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -52,7 +52,7 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
 	if (show_only || verbose) {
 		enum object_type type = sha1_object_info(oid->hash, NULL);
 		printf("%s %s\n", oid_to_hex(oid),
-		       (type > 0) ? typename(type) : "unknown");
+		       (type > 0) ? type_name(type) : "unknown");
 	}
 	if (!show_only)
 		unlink_or_warn(fullpath);
diff --git a/builtin/replace.c b/builtin/replace.c
index 10078ae37..42cf4f62a 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -56,8 +56,8 @@ static int show_reference(const char *refname, const struct object_id *oid,
 			obj_type = sha1_object_info(object.hash, NULL);
 			repl_type = sha1_object_info(oid->hash, NULL);
 
-			printf("%s (%s) -> %s (%s)\n", refname, typename(obj_type),
-			       oid_to_hex(oid), typename(repl_type));
+			printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
+			       oid_to_hex(oid), type_name(repl_type));
 		}
 	}
 
@@ -168,8 +168,8 @@ static int replace_object_oid(const char *object_ref,
 		die("Objects must be of the same type.\n"
 		    "'%s' points to a replaced object of type '%s'\n"
 		    "while '%s' points to a replacement object of type '%s'.",
-		    object_ref, typename(obj_type),
-		    replace_ref, typename(repl_type));
+		    object_ref, type_name(obj_type),
+		    replace_ref, type_name(repl_type));
 
 	check_ref_valid(object, &prev, &ref, force);
 
@@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,
 	argv_array_push(&cmd.args, "--no-replace-objects");
 	argv_array_push(&cmd.args, "cat-file");
 	if (raw)
-		argv_array_push(&cmd.args, typename(type));
+		argv_array_push(&cmd.args, type_name(type));
 	else
 		argv_array_push(&cmd.args, "-p");
 	argv_array_push(&cmd.args, oid_to_hex(oid));
@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
 	struct tag *tag;
 	int i;
 
-	hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
+	hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);
 	tag = lookup_tag(&tag_oid);
 	if (!tag)
 		die(_("bad mergetag in commit '%s'"), ref);
diff --git a/builtin/tag.c b/builtin/tag.c
index a7e6a5b0f..7e0881fba 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -220,7 +220,7 @@ static void create_tag(const struct object_id *object, const char *tag,
 		    "tag %s\n"
 		    "tagger %s\n\n",
 		    oid_to_hex(object),
-		    typename(type),
+		    type_name(type),
 		    tag,
 		    git_committer_info(IDENT_STRICT));
 
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 62ea264c4..e93079070 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -172,7 +172,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
 {
 	struct object_id oid;
 
-	if (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0)
+	if (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)
 		die("failed to write object %s", oid_to_hex(&obj->oid));
 	obj->flags |= FLAG_WRITTEN;
 }
@@ -237,14 +237,14 @@ static void write_object(unsigned nr, enum object_type type,
 			 void *buf, unsigned long size)
 {
 	if (!strict) {
-		if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
+		if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
 			die("failed to write object");
 		added_object(nr, type, buf, size);
 		free(buf);
 		obj_list[nr].obj = NULL;
 	} else if (type == OBJ_BLOB) {
 		struct blob *blob;
-		if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
+		if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
 			die("failed to write object");
 		added_object(nr, type, buf, size);
 		free(buf);
@@ -258,12 +258,12 @@ static void write_object(unsigned nr, enum object_type type,
 	} else {
 		struct object *obj;
 		int eaten;
-		hash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);
+		hash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);
 		added_object(nr, type, buf, size);
 		obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
 					  &eaten);
 		if (!obj)
-			die("invalid %s", typename(type));
+			die("invalid %s", type_name(type));
 		add_object_buffer(obj, buf, size);
 		obj->flags |= FLAG_OPEN;
 		obj_list[nr].obj = obj;
diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c
index ba38ac9b1..05315ea7c 100644
--- a/builtin/verify-commit.c
+++ b/builtin/verify-commit.c
@@ -49,7 +49,7 @@ static int verify_commit(const char *name, unsigned flags)
 		return error("%s: unable to read file.", name);
 	if (type != OBJ_COMMIT)
 		return error("%s: cannot verify a non-commit object of type %s.",
-				name, typename(type));
+				name, type_name(type));
 
 	ret = run_gpg_verify(&oid, buf, size, flags);
 
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 3310fd210..bb788494f 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -203,7 +203,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
 		return error("cannot find the current offset");
 
 	header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
-			       typename(type), (uintmax_t)size) + 1;
+			       type_name(type), (uintmax_t)size) + 1;
 	git_SHA1_Init(&ctx);
 	git_SHA1_Update(&ctx, obuf, header_len);
 
diff --git a/commit.c b/commit.c
index ff51c9f34..cd9ace105 100644
--- a/commit.c
+++ b/commit.c
@@ -274,7 +274,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
 			    oid_to_hex(&commit->object.oid));
 		if (type != OBJ_COMMIT)
 			die("expected commit for %s, got %s",
-			    oid_to_hex(&commit->object.oid), typename(type));
+			    oid_to_hex(&commit->object.oid), type_name(type));
 		if (sizep)
 			*sizep = size;
 	}
diff --git a/contrib/examples/builtin-fetch--tool.c b/contrib/examples/builtin-fetch--tool.c
index a3eb19de0..22648c3af 100644
--- a/contrib/examples/builtin-fetch--tool.c
+++ b/contrib/examples/builtin-fetch--tool.c
@@ -15,7 +15,7 @@ static char *get_stdin(void)
 
 static void show_new(enum object_type type, unsigned char *sha1_new)
 {
-	fprintf(stderr, "  %s: %s\n", typename(type),
+	fprintf(stderr, "  %s: %s\n", type_name(type),
 		find_unique_abbrev(sha1_new, DEFAULT_ABBREV));
 }
 
diff --git a/fast-import.c b/fast-import.c
index b70ac025e..92b89d191 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1096,7 +1096,7 @@ static int store_object(
 	git_zstream s;
 
 	hdrlen = xsnprintf((char *)hdr, sizeof(hdr), "%s %lu",
-			   typename(type), (unsigned long)dat->len) + 1;
+			   type_name(type), (unsigned long)dat->len) + 1;
 	git_SHA1_Init(&c);
 	git_SHA1_Update(&c, hdr, hdrlen);
 	git_SHA1_Update(&c, dat->buf, dat->len);
@@ -2421,7 +2421,7 @@ static void file_change_m(const char *p, struct branch *b)
 		else if (oe) {
 			if (oe->type != OBJ_COMMIT)
 				die("Not a commit (actually a %s): %s",
-					typename(oe->type), command_buf.buf);
+					type_name(oe->type), command_buf.buf);
 		}
 		/*
 		 * Accept the sha1 without checking; it expected to be in
@@ -2448,7 +2448,7 @@ static void file_change_m(const char *p, struct branch *b)
 					command_buf.buf);
 		if (type != expected)
 			die("Not a %s (actually a %s): %s",
-				typename(expected), typename(type),
+				type_name(expected), type_name(type),
 				command_buf.buf);
 	}
 
@@ -2599,14 +2599,14 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
 	} else if (oe) {
 		if (oe->type != OBJ_BLOB)
 			die("Not a blob (actually a %s): %s",
-				typename(oe->type), command_buf.buf);
+				type_name(oe->type), command_buf.buf);
 	} else if (!is_null_oid(&oid)) {
 		enum object_type type = sha1_object_info(oid.hash, NULL);
 		if (type < 0)
 			die("Blob not found: %s", command_buf.buf);
 		if (type != OBJ_BLOB)
 			die("Not a blob (actually a %s): %s",
-			    typename(type), command_buf.buf);
+			    type_name(type), command_buf.buf);
 	}
 
 	construct_path_with_fanout(oid_to_hex(&commit_oid), *old_fanout, path);
@@ -2914,7 +2914,7 @@ static void parse_new_tag(const char *arg)
 		    "object %s\n"
 		    "type %s\n"
 		    "tag %s\n",
-		    oid_to_hex(&oid), typename(type), t->name);
+		    oid_to_hex(&oid), type_name(type), t->name);
 	if (tagger)
 		strbuf_addf(&new_data,
 			    "tagger %s\n", tagger);
@@ -2985,10 +2985,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
 		die("Can't read object %s", oid_to_hex(oid));
 	if (type != OBJ_BLOB)
 		die("Object %s is a %s but a blob was expected.",
-		    oid_to_hex(oid), typename(type));
+		    oid_to_hex(oid), type_name(type));
 	strbuf_reset(&line);
 	strbuf_addf(&line, "%s %s %lu\n", oid_to_hex(oid),
-						typename(type), size);
+						type_name(type), size);
 	cat_blob_write(line.buf, line.len);
 	strbuf_release(&line);
 	cat_blob_write(buf, size);
diff --git a/fsck.c b/fsck.c
index 032699e9a..5c8c12dde 100644
--- a/fsck.c
+++ b/fsck.c
@@ -821,7 +821,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
 			ret = report(options, &tag->object,
 				FSCK_MSG_TAG_OBJECT_NOT_TAG,
 				"expected tag got %s",
-			    typename(type));
+			    type_name(type));
 			goto done;
 		}
 	}
diff --git a/http-push.c b/http-push.c
index 14435ab65..8814aa12e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -362,7 +362,7 @@ static void start_put(struct transfer_request *request)
 	git_zstream stream;
 
 	unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
-	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
 
 	/* Set it up */
 	git_deflate_init(&stream, zlib_compression_level);
diff --git a/log-tree.c b/log-tree.c
index fca29d479..2eeddbeb3 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -499,7 +499,7 @@ static void show_one_mergetag(struct commit *commit,
 	int status, nth;
 	size_t payload_size, gpg_message_offset;
 
-	hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
+	hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);
 	tag = lookup_tag(&oid);
 	if (!tag)
 		return; /* error message already given */
diff --git a/object.c b/object.c
index 0afdfd19b..0db33b26b 100644
--- a/object.c
+++ b/object.c
@@ -26,7 +26,7 @@ static const char *object_type_strings[] = {
 	"tag",		/* OBJ_TAG = 4 */
 };
 
-const char *typename(unsigned int type)
+const char *type_name(unsigned int type)
 {
 	if (type >= ARRAY_SIZE(object_type_strings))
 		return NULL;
@@ -166,7 +166,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
 		if (!quiet)
 			error("object %s is a %s, not a %s",
 			      oid_to_hex(&obj->oid),
-			      typename(obj->type), typename(type));
+			      type_name(obj->type), type_name(type));
 		return NULL;
 	}
 }
@@ -265,7 +265,7 @@ struct object *parse_object(const struct object_id *oid)
 
 	buffer = read_sha1_file(oid->hash, &type, &size);
 	if (buffer) {
-		if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
+		if (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {
 			free(buffer);
 			error("sha1 mismatch %s", sha1_to_hex(repl));
 			return NULL;
diff --git a/object.h b/object.h
index 87563d905..a5eb26380 100644
--- a/object.h
+++ b/object.h
@@ -53,7 +53,7 @@ struct object {
 	struct object_id oid;
 };
 
-extern const char *typename(unsigned int type);
+extern const char *type_name(unsigned int type);
 extern int type_from_string_gently(const char *str, ssize_t, int gentle);
 #define type_from_string(str) type_from_string_gently(str, -1, 0)
 
diff --git a/pack-check.c b/pack-check.c
index 073c1fbd4..bd348592f 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -141,7 +141,7 @@ static int verify_packfile(struct packed_git *p,
 			err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
 				    oid_to_hex(entries[i].oid.oid), p->pack_name,
 				    (uintmax_t)entries[i].offset);
-		else if (check_sha1_signature(entries[i].oid.hash, data, size, typename(type)))
+		else if (check_sha1_signature(entries[i].oid.hash, data, size, type_name(type)))
 			err = error("packed %s from %s is corrupt",
 				    oid_to_hex(entries[i].oid.oid), p->pack_name);
 		else if (fn) {
diff --git a/packfile.c b/packfile.c
index 6657a0a49..0532a371b 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1357,7 +1357,7 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
 		if (oi->typep)
 			*oi->typep = ptot;
 		if (oi->type_name) {
-			const char *tn = typename(ptot);
+			const char *tn = type_name(ptot);
 			if (tn)
 				strbuf_addstr(oi->type_name, tn);
 		}
diff --git a/reachable.c b/reachable.c
index 88d7d679d..191ebe3e6 100644
--- a/reachable.c
+++ b/reachable.c
@@ -94,7 +94,7 @@ static void add_recent_object(const struct object_id *oid,
 		break;
 	default:
 		die("unknown object type for %s: %s",
-		    oid_to_hex(oid), typename(type));
+		    oid_to_hex(oid), type_name(type));
 	}
 
 	if (!obj)
diff --git a/ref-filter.c b/ref-filter.c
index f9e25aea7..9dae6cfe3 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -769,7 +769,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
 		if (deref)
 			name++;
 		if (!strcmp(name, "objecttype"))
-			v->s = typename(obj->type);
+			v->s = type_name(obj->type);
 		else if (!strcmp(name, "objectsize")) {
 			v->value = sz;
 			v->s = xstrfmt("%lu", sz);
@@ -795,7 +795,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
 		if (!strcmp(name, "tag"))
 			v->s = tag->tag;
 		else if (!strcmp(name, "type") && tag->tagged)
-			v->s = typename(tag->tagged->type);
+			v->s = type_name(tag->tagged->type);
 		else if (!strcmp(name, "object") && tag->tagged)
 			v->s = xstrdup(oid_to_hex(&tag->tagged->oid));
 	}
diff --git a/sequencer.c b/sequencer.c
index 4d3f60594..f6b77e6bd 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2348,7 +2348,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
 			if (!lookup_commit_reference_gently(&oid, 1)) {
 				enum object_type type = sha1_object_info(oid.hash, NULL);
 				return error(_("%s: can't cherry-pick a %s"),
-					name, typename(type));
+					name, type_name(type));
 			}
 		} else
 			return error(_("%s: bad revision"), name);
diff --git a/sha1_file.c b/sha1_file.c
index 2c03458ea..2288bb75c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -805,7 +805,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
 		return -1;
 
 	/* Generate the header */
-	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(obj_type), size) + 1;
+	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(obj_type), size) + 1;
 
 	/* Sha1.. */
 	git_SHA1_Init(&c);
@@ -1240,7 +1240,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
 			if (oi->delta_base_sha1)
 				hashclr(oi->delta_base_sha1);
 			if (oi->type_name)
-				strbuf_addstr(oi->type_name, typename(co->type));
+				strbuf_addstr(oi->type_name, type_name(co->type));
 			if (oi->contentp)
 				*oi->contentp = xmemdupz(co->buf, co->size);
 			oi->whence = OI_CACHED;
@@ -1317,7 +1317,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
 {
 	struct cached_object *co;
 
-	hash_sha1_file(buf, len, typename(type), sha1);
+	hash_sha1_file(buf, len, type_name(type), sha1);
 	if (has_sha1_file(sha1) || find_cached_object(sha1))
 		return 0;
 	ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
@@ -1683,7 +1683,7 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
 	buf = read_object(sha1, &type, &len);
 	if (!buf)
 		return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
-	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
 	ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
 	free(buf);
 
@@ -1767,9 +1767,9 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,
 	}
 
 	if (write_object)
-		ret = write_sha1_file(buf, size, typename(type), oid->hash);
+		ret = write_sha1_file(buf, size, type_name(type), oid->hash);
 	else
-		ret = hash_sha1_file(buf, size, typename(type), oid->hash);
+		ret = hash_sha1_file(buf, size, type_name(type), oid->hash);
 	if (re_allocated)
 		free(buf);
 	return ret;
@@ -1789,10 +1789,10 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,
 				 get_safe_crlf(flags));
 
 	if (write_object)
-		ret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
+		ret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 				      oid->hash);
 	else
-		ret = hash_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
+		ret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 				     oid->hash);
 	strbuf_release(&sbuf);
 	return ret;
@@ -1942,7 +1942,7 @@ void assert_sha1_type(const unsigned char *sha1, enum object_type expect)
 		die("%s is not a valid object", sha1_to_hex(sha1));
 	if (type != expect)
 		die("%s is not a valid '%s' object", sha1_to_hex(sha1),
-		    typename(expect));
+		    type_name(expect));
 }
 
 int for_each_file_in_obj_subdir(unsigned int subdir_nr,
@@ -2187,7 +2187,7 @@ int read_loose_object(const char *path,
 			goto out;
 		}
 		if (check_sha1_signature(expected_sha1, *contents,
-					 *size, typename(*type))) {
+					 *size, type_name(*type))) {
 			error("sha1 mismatch for %s (expected %s)", path,
 			      sha1_to_hex(expected_sha1));
 			free(*contents);
diff --git a/sha1_name.c b/sha1_name.c
index 611c7d24d..e7c18ffc2 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -381,7 +381,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
 
 	advise("  %s %s%s",
 	       find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
-	       typename(type) ? typename(type) : "unknown type",
+	       type_name(type) ? type_name(type) : "unknown type",
 	       desc.buf);
 
 	strbuf_release(&desc);
@@ -901,8 +901,8 @@ struct object *peel_to_type(const char *name, int namelen,
 			if (name)
 				error("%.*s: expected %s type, but the object "
 				      "dereferences to %s type",
-				      namelen, name, typename(expected_type),
-				      typename(o->type));
+				      namelen, name, type_name(expected_type),
+				      type_name(o->type));
 			return NULL;
 		}
 	}
diff --git a/submodule.c b/submodule.c
index 47ddc9b27..cd18400e8 100644
--- a/submodule.c
+++ b/submodule.c
@@ -831,7 +831,7 @@ static int check_has_commit(const struct object_id *oid, void *data)
 		return 0;
 	default:
 		die(_("submodule entry '%s' (%s) is a %s, not a commit"),
-		    cb->path, oid_to_hex(oid), typename(type));
+		    cb->path, oid_to_hex(oid), type_name(type));
 	}
 }
 
diff --git a/tag.c b/tag.c
index fcbe012f7..66210fd47 100644
--- a/tag.c
+++ b/tag.c
@@ -47,7 +47,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
 				name_to_report ?
 				name_to_report :
 				find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
-				typename(type));
+				type_name(type));
 
 	buf = read_sha1_file(oid->hash, &type, &size);
 	if (!buf)
diff --git a/walker.c b/walker.c
index 5d4d3733f..dffb9c8e3 100644
--- a/walker.c
+++ b/walker.c
@@ -22,7 +22,7 @@ void walker_say(struct walker *walker, const char *fmt, ...)
 static void report_missing(const struct object *obj)
 {
 	fprintf(stderr, "Cannot obtain needed %s %s\n",
-		obj->type ? typename(obj->type): "object",
+		obj->type ? type_name(obj->type): "object",
 		oid_to_hex(&obj->oid));
 	if (!is_null_oid(&current_commit_oid))
 		fprintf(stderr, "while processing commit %s.\n",
@@ -134,7 +134,7 @@ static int process_object(struct walker *walker, struct object *obj)
 	}
 	return error("Unable to determine requirements "
 		     "of type %s for %s",
-		     typename(obj->type), oid_to_hex(&obj->oid));
+		     type_name(obj->type), oid_to_hex(&obj->oid));
 }
 
 static int process(struct walker *walker, struct object *obj)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 03/37] blame: rename 'this' variables
  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 ` Brandon Williams
  2018-01-29 22:36 ` [PATCH 04/37] pack-objects: " Brandon Williams
                   ` (36 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 blame.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/blame.c b/blame.c
index 2893f3c10..21c867664 100644
--- a/blame.c
+++ b/blame.c
@@ -998,28 +998,29 @@ unsigned blame_entry_score(struct blame_scoreboard *sb, struct blame_entry *e)
 }
 
 /*
- * best_so_far[] and this[] are both a split of an existing blame_entry
- * that passes blame to the parent.  Maintain best_so_far the best split
- * so far, by comparing this and best_so_far and copying this into
+ * best_so_far[] and potential[] are both a split of an existing blame_entry
+ * that passes blame to the parent.  Maintain best_so_far the best split so
+ * far, by comparing potential and best_so_far and copying potential into
  * bst_so_far as needed.
  */
 static void copy_split_if_better(struct blame_scoreboard *sb,
 				 struct blame_entry *best_so_far,
-				 struct blame_entry *this)
+				 struct blame_entry *potential)
 {
 	int i;
 
-	if (!this[1].suspect)
+	if (!potential[1].suspect)
 		return;
 	if (best_so_far[1].suspect) {
-		if (blame_entry_score(sb, &this[1]) < blame_entry_score(sb, &best_so_far[1]))
+		if (blame_entry_score(sb, &potential[1]) <
+		    blame_entry_score(sb, &best_so_far[1]))
 			return;
 	}
 
 	for (i = 0; i < 3; i++)
-		blame_origin_incref(this[i].suspect);
+		blame_origin_incref(potential[i].suspect);
 	decref_split(best_so_far);
-	memcpy(best_so_far, this, sizeof(struct blame_entry [3]));
+	memcpy(best_so_far, potential, sizeof(struct blame_entry[3]));
 }
 
 /*
@@ -1046,12 +1047,12 @@ static void handle_split(struct blame_scoreboard *sb,
 	if (ent->num_lines <= tlno)
 		return;
 	if (tlno < same) {
-		struct blame_entry this[3];
+		struct blame_entry potential[3];
 		tlno += ent->s_lno;
 		same += ent->s_lno;
-		split_overlap(this, ent, tlno, plno, same, parent);
-		copy_split_if_better(sb, split, this);
-		decref_split(this);
+		split_overlap(potential, ent, tlno, plno, same, parent);
+		copy_split_if_better(sb, split, potential);
+		decref_split(potential);
 	}
 }
 
@@ -1273,7 +1274,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
 			struct diff_filepair *p = diff_queued_diff.queue[i];
 			struct blame_origin *norigin;
 			mmfile_t file_p;
-			struct blame_entry this[3];
+			struct blame_entry potential[3];
 
 			if (!DIFF_FILE_VALID(p->one))
 				continue; /* does not exist in parent */
@@ -1292,10 +1293,10 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
 
 			for (j = 0; j < num_ents; j++) {
 				find_copy_in_blob(sb, blame_list[j].ent,
-						  norigin, this, &file_p);
+						  norigin, potential, &file_p);
 				copy_split_if_better(sb, blame_list[j].split,
-						     this);
-				decref_split(this);
+						     potential);
+				decref_split(potential);
 			}
 			blame_origin_decref(norigin);
 		}
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 04/37] pack-objects: rename 'this' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (2 preceding siblings ...)
  2018-01-29 22:36 ` [PATCH 03/37] blame: rename 'this' variables Brandon Williams
@ 2018-01-29 22:36 ` Brandon Williams
  2018-01-29 22:36 ` [PATCH 05/37] rev-parse: rename 'this' variable Brandon Williams
                   ` (35 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/pack-objects.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 6b9cfc289..bfda8602c 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1376,10 +1376,10 @@ static void cleanup_preferred_base(void)
 	it = pbase_tree;
 	pbase_tree = NULL;
 	while (it) {
-		struct pbase_tree *this = it;
-		it = this->next;
-		free(this->pcache.tree_data);
-		free(this);
+		struct pbase_tree *tmp = it;
+		it = tmp->next;
+		free(tmp->pcache.tree_data);
+		free(tmp);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(pbase_tree_cache); i++) {
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 05/37] rev-parse: rename 'this' variable
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (3 preceding siblings ...)
  2018-01-29 22:36 ` [PATCH 04/37] pack-objects: " Brandon Williams
@ 2018-01-29 22:36 ` Brandon Williams
  2018-01-29 22:36 ` [PATCH 06/37] diff: rename 'this' variables Brandon Williams
                   ` (34 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/rev-parse.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 74aa644cb..171c7a2b4 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -243,28 +243,28 @@ static int show_file(const char *arg, int output_prefix)
 static int try_difference(const char *arg)
 {
 	char *dotdot;
-	struct object_id oid;
-	struct object_id end;
-	const char *next;
-	const char *this;
+	struct object_id start_oid;
+	struct object_id end_oid;
+	const char *end;
+	const char *start;
 	int symmetric;
 	static const char head_by_default[] = "HEAD";
 
 	if (!(dotdot = strstr(arg, "..")))
 		return 0;
-	next = dotdot + 2;
-	this = arg;
-	symmetric = (*next == '.');
+	end = dotdot + 2;
+	start = arg;
+	symmetric = (*end == '.');
 
 	*dotdot = 0;
-	next += symmetric;
+	end += symmetric;
 
-	if (!*next)
-		next = head_by_default;
+	if (!*end)
+		end = head_by_default;
 	if (dotdot == arg)
-		this = head_by_default;
+		start = head_by_default;
 
-	if (this == head_by_default && next == head_by_default &&
+	if (start == head_by_default && end == head_by_default &&
 	    !symmetric) {
 		/*
 		 * Just ".."?  That is not a range but the
@@ -274,14 +274,14 @@ static int try_difference(const char *arg)
 		return 0;
 	}
 
-	if (!get_oid_committish(this, &oid) && !get_oid_committish(next, &end)) {
-		show_rev(NORMAL, &end, next);
-		show_rev(symmetric ? NORMAL : REVERSED, &oid, this);
+	if (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {
+		show_rev(NORMAL, &end_oid, end);
+		show_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);
 		if (symmetric) {
 			struct commit_list *exclude;
 			struct commit *a, *b;
-			a = lookup_commit_reference(&oid);
-			b = lookup_commit_reference(&end);
+			a = lookup_commit_reference(&start_oid);
+			b = lookup_commit_reference(&end_oid);
 			exclude = get_merge_bases(a, b);
 			while (exclude) {
 				struct commit *commit = pop_commit(&exclude);
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 06/37] diff: rename 'this' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (4 preceding siblings ...)
  2018-01-29 22:36 ` [PATCH 05/37] rev-parse: rename 'this' variable Brandon Williams
@ 2018-01-29 22:36 ` Brandon Williams
  2018-01-29 22:36 ` [PATCH 07/37] apply: rename 'try' variables Brandon Williams
                   ` (33 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 diff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/diff.c b/diff.c
index 0a9a0cdf1..d682d0d1f 100644
--- a/diff.c
+++ b/diff.c
@@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
 	while (dir->nr) {
 		struct dirstat_file *f = dir->files;
 		int namelen = strlen(f->name);
-		unsigned long this;
+		unsigned long sum;
 		char *slash;
 
 		if (namelen < baselen)
@@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
 		slash = strchr(f->name + baselen, '/');
 		if (slash) {
 			int newbaselen = slash + 1 - f->name;
-			this = gather_dirstat(opt, dir, changed, f->name, newbaselen);
+			sum = gather_dirstat(opt, dir, changed, f->name, newbaselen);
 			sources++;
 		} else {
-			this = f->changed;
+			sum = f->changed;
 			dir->files++;
 			dir->nr--;
 			sources += 2;
 		}
-		this_dir += this;
+		this_dir += sum;
 	}
 
 	/*
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 07/37] apply: rename 'try' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (5 preceding siblings ...)
  2018-01-29 22:36 ` [PATCH 06/37] diff: rename 'this' variables Brandon Williams
@ 2018-01-29 22:36 ` Brandon Williams
  2018-01-29 22:36 ` [PATCH 08/37] apply: rename 'new' variables Brandon Williams
                   ` (32 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 apply.c | 68 ++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/apply.c b/apply.c
index 321a9fa68..071f653c6 100644
--- a/apply.c
+++ b/apply.c
@@ -2386,8 +2386,8 @@ static void update_pre_post_images(struct image *preimage,
 static int line_by_line_fuzzy_match(struct image *img,
 				    struct image *preimage,
 				    struct image *postimage,
-				    unsigned long try,
-				    int try_lno,
+				    unsigned long current,
+				    int current_lno,
 				    int preimage_limit)
 {
 	int i;
@@ -2404,9 +2404,9 @@ static int line_by_line_fuzzy_match(struct image *img,
 
 	for (i = 0; i < preimage_limit; i++) {
 		size_t prelen = preimage->line[i].len;
-		size_t imglen = img->line[try_lno+i].len;
+		size_t imglen = img->line[current_lno+i].len;
 
-		if (!fuzzy_matchlines(img->buf + try + imgoff, imglen,
+		if (!fuzzy_matchlines(img->buf + current + imgoff, imglen,
 				      preimage->buf + preoff, prelen))
 			return 0;
 		if (preimage->line[i].flag & LINE_COMMON)
@@ -2443,7 +2443,7 @@ static int line_by_line_fuzzy_match(struct image *img,
 	 */
 	extra_chars = preimage_end - preimage_eof;
 	strbuf_init(&fixed, imgoff + extra_chars);
-	strbuf_add(&fixed, img->buf + try, imgoff);
+	strbuf_add(&fixed, img->buf + current, imgoff);
 	strbuf_add(&fixed, preimage_eof, extra_chars);
 	fixed_buf = strbuf_detach(&fixed, &fixed_len);
 	update_pre_post_images(preimage, postimage,
@@ -2455,8 +2455,8 @@ static int match_fragment(struct apply_state *state,
 			  struct image *img,
 			  struct image *preimage,
 			  struct image *postimage,
-			  unsigned long try,
-			  int try_lno,
+			  unsigned long current,
+			  int current_lno,
 			  unsigned ws_rule,
 			  int match_beginning, int match_end)
 {
@@ -2466,12 +2466,12 @@ static int match_fragment(struct apply_state *state,
 	size_t fixed_len, postlen;
 	int preimage_limit;
 
-	if (preimage->nr + try_lno <= img->nr) {
+	if (preimage->nr + current_lno <= img->nr) {
 		/*
 		 * The hunk falls within the boundaries of img.
 		 */
 		preimage_limit = preimage->nr;
-		if (match_end && (preimage->nr + try_lno != img->nr))
+		if (match_end && (preimage->nr + current_lno != img->nr))
 			return 0;
 	} else if (state->ws_error_action == correct_ws_error &&
 		   (ws_rule & WS_BLANK_AT_EOF)) {
@@ -2482,7 +2482,7 @@ static int match_fragment(struct apply_state *state,
 		 * match with img, and the remainder of the preimage
 		 * must be blank.
 		 */
-		preimage_limit = img->nr - try_lno;
+		preimage_limit = img->nr - current_lno;
 	} else {
 		/*
 		 * The hunk extends beyond the end of the img and
@@ -2492,27 +2492,27 @@ static int match_fragment(struct apply_state *state,
 		return 0;
 	}
 
-	if (match_beginning && try_lno)
+	if (match_beginning && current_lno)
 		return 0;
 
 	/* Quick hash check */
 	for (i = 0; i < preimage_limit; i++)
-		if ((img->line[try_lno + i].flag & LINE_PATCHED) ||
-		    (preimage->line[i].hash != img->line[try_lno + i].hash))
+		if ((img->line[current_lno + i].flag & LINE_PATCHED) ||
+		    (preimage->line[i].hash != img->line[current_lno + i].hash))
 			return 0;
 
 	if (preimage_limit == preimage->nr) {
 		/*
 		 * Do we have an exact match?  If we were told to match
-		 * at the end, size must be exactly at try+fragsize,
-		 * otherwise try+fragsize must be still within the preimage,
+		 * at the end, size must be exactly at current+fragsize,
+		 * otherwise current+fragsize must be still within the preimage,
 		 * and either case, the old piece should match the preimage
 		 * exactly.
 		 */
 		if ((match_end
-		     ? (try + preimage->len == img->len)
-		     : (try + preimage->len <= img->len)) &&
-		    !memcmp(img->buf + try, preimage->buf, preimage->len))
+		     ? (current + preimage->len == img->len)
+		     : (current + preimage->len <= img->len)) &&
+		    !memcmp(img->buf + current, preimage->buf, preimage->len))
 			return 1;
 	} else {
 		/*
@@ -2543,7 +2543,7 @@ static int match_fragment(struct apply_state *state,
 	 */
 	if (state->ws_ignore_action == ignore_ws_change)
 		return line_by_line_fuzzy_match(img, preimage, postimage,
-						try, try_lno, preimage_limit);
+						current, current_lno, preimage_limit);
 
 	if (state->ws_error_action != correct_ws_error)
 		return 0;
@@ -2577,10 +2577,10 @@ static int match_fragment(struct apply_state *state,
 	 */
 	strbuf_init(&fixed, preimage->len + 1);
 	orig = preimage->buf;
-	target = img->buf + try;
+	target = img->buf + current;
 	for (i = 0; i < preimage_limit; i++) {
 		size_t oldlen = preimage->line[i].len;
-		size_t tgtlen = img->line[try_lno + i].len;
+		size_t tgtlen = img->line[current_lno + i].len;
 		size_t fixstart = fixed.len;
 		struct strbuf tgtfix;
 		int match;
@@ -2666,8 +2666,8 @@ static int find_pos(struct apply_state *state,
 		    int match_beginning, int match_end)
 {
 	int i;
-	unsigned long backwards, forwards, try;
-	int backwards_lno, forwards_lno, try_lno;
+	unsigned long backwards, forwards, current;
+	int backwards_lno, forwards_lno, current_lno;
 
 	/*
 	 * If match_beginning or match_end is specified, there is no
@@ -2687,25 +2687,25 @@ static int find_pos(struct apply_state *state,
 	if ((size_t) line > img->nr)
 		line = img->nr;
 
-	try = 0;
+	current = 0;
 	for (i = 0; i < line; i++)
-		try += img->line[i].len;
+		current += img->line[i].len;
 
 	/*
 	 * There's probably some smart way to do this, but I'll leave
 	 * that to the smart and beautiful people. I'm simple and stupid.
 	 */
-	backwards = try;
+	backwards = current;
 	backwards_lno = line;
-	forwards = try;
+	forwards = current;
 	forwards_lno = line;
-	try_lno = line;
+	current_lno = line;
 
 	for (i = 0; ; i++) {
 		if (match_fragment(state, img, preimage, postimage,
-				   try, try_lno, ws_rule,
+				   current, current_lno, ws_rule,
 				   match_beginning, match_end))
-			return try_lno;
+			return current_lno;
 
 	again:
 		if (backwards_lno == 0 && forwards_lno == img->nr)
@@ -2718,8 +2718,8 @@ static int find_pos(struct apply_state *state,
 			}
 			backwards_lno--;
 			backwards -= img->line[backwards_lno].len;
-			try = backwards;
-			try_lno = backwards_lno;
+			current = backwards;
+			current_lno = backwards_lno;
 		} else {
 			if (forwards_lno == img->nr) {
 				i++;
@@ -2727,8 +2727,8 @@ static int find_pos(struct apply_state *state,
 			}
 			forwards += img->line[forwards_lno].len;
 			forwards_lno++;
-			try = forwards;
-			try_lno = forwards_lno;
+			current = forwards;
+			current_lno = forwards_lno;
 		}
 
 	}
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 08/37] apply: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (6 preceding siblings ...)
  2018-01-29 22:36 ` [PATCH 07/37] apply: rename 'try' variables Brandon Williams
@ 2018-01-29 22:36 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 09/37] checkout: " Brandon Williams
                   ` (31 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:36 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 apply.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/apply.c b/apply.c
index 071f653c6..657c73930 100644
--- a/apply.c
+++ b/apply.c
@@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,
 				   size_t len, size_t postlen)
 {
 	int i, ctx, reduced;
-	char *new, *old, *fixed;
+	char *new_buf, *old, *fixed;
 	struct image fixed_preimage;
 
 	/*
@@ -2329,18 +2329,18 @@ static void update_pre_post_images(struct image *preimage,
 	 */
 	old = postimage->buf;
 	if (postlen)
-		new = postimage->buf = xmalloc(postlen);
+		new_buf = postimage->buf = xmalloc(postlen);
 	else
-		new = old;
+		new_buf = old;
 	fixed = preimage->buf;
 
 	for (i = reduced = ctx = 0; i < postimage->nr; i++) {
 		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, l_len);
+			memmove(new_buf, old, l_len);
 			old += l_len;
-			new += l_len;
+			new_buf += l_len;
 			continue;
 		}
 
@@ -2365,21 +2365,21 @@ static void update_pre_post_images(struct image *preimage,
 
 		/* and copy it in, while fixing the line length */
 		l_len = preimage->line[ctx].len;
-		memcpy(new, fixed, l_len);
-		new += l_len;
+		memcpy(new_buf, fixed, l_len);
+		new_buf += l_len;
 		fixed += l_len;
 		postimage->line[i].len = l_len;
 		ctx++;
 	}
 
 	if (postlen
-	    ? postlen < new - postimage->buf
-	    : postimage->len < new - postimage->buf)
+	    ? postlen < new_buf - postimage->buf
+	    : postimage->len < new_buf - postimage->buf)
 		die("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d",
-		    (int)postlen, (int) postimage->len, (int)(new - postimage->buf));
+		    (int)postlen, (int) postimage->len, (int)(new_buf - postimage->buf));
 
 	/* Fix the length of the whole thing */
-	postimage->len = new - postimage->buf;
+	postimage->len = new_buf - postimage->buf;
 	postimage->nr -= reduced;
 }
 
@@ -4163,30 +4163,30 @@ static void show_mode_change(struct patch *p, int show_name)
 static void show_rename_copy(struct patch *p)
 {
 	const char *renamecopy = p->is_rename ? "rename" : "copy";
-	const char *old, *new;
+	const char *old, *new_name;
 
 	/* Find common prefix */
 	old = p->old_name;
-	new = p->new_name;
+	new_name = p->new_name;
 	while (1) {
 		const char *slash_old, *slash_new;
 		slash_old = strchr(old, '/');
-		slash_new = strchr(new, '/');
+		slash_new = strchr(new_name, '/');
 		if (!slash_old ||
 		    !slash_new ||
-		    slash_old - old != slash_new - new ||
-		    memcmp(old, new, slash_new - new))
+		    slash_old - old != slash_new - new_name ||
+		    memcmp(old, new_name, slash_new - new_name))
 			break;
 		old = slash_old + 1;
-		new = slash_new + 1;
+		new_name = slash_new + 1;
 	}
-	/* p->old_name thru old is the common prefix, and old and new
+	/* p->old_name thru old is the common prefix, and old and new_name
 	 * through the end of names are renames
 	 */
 	if (old != p->old_name)
 		printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy,
 		       (int)(old - p->old_name), p->old_name,
-		       old, new, p->score);
+		       old, new_name, p->score);
 	else
 		printf(" %s %s => %s (%d%%)\n", renamecopy,
 		       p->old_name, p->new_name, p->score);
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 09/37] checkout: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (7 preceding siblings ...)
  2018-01-29 22:36 ` [PATCH 08/37] apply: rename 'new' variables Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 10/37] help: " Brandon Williams
                   ` (30 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/checkout.c | 138 ++++++++++++++++++++++++++---------------------------
 1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index c54c78df5..30f09ec50 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -54,14 +54,14 @@ struct checkout_opts {
 	struct tree *source_tree;
 };
 
-static int post_checkout_hook(struct commit *old, struct commit *new,
+static int post_checkout_hook(struct commit *old, struct commit *new_commit,
 			      int changed)
 {
 	return run_hook_le(NULL, "post-checkout",
 			   oid_to_hex(old ? &old->object.oid : &null_oid),
-			   oid_to_hex(new ? &new->object.oid : &null_oid),
+			   oid_to_hex(new_commit ? &new_commit->object.oid : &null_oid),
 			   changed ? "1" : "0", NULL);
-	/* "new" can be NULL when checking out from the index before
+	/* "new_commit" can be NULL when checking out from the index before
 	   a commit exists. */
 
 }
@@ -473,7 +473,7 @@ static void setup_branch_path(struct branch_info *branch)
 
 static int merge_working_tree(const struct checkout_opts *opts,
 			      struct branch_info *old,
-			      struct branch_info *new,
+			      struct branch_info *new_branch_info,
 			      int *writeout_error)
 {
 	int ret;
@@ -485,7 +485,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
 
 	resolve_undo_clear();
 	if (opts->force) {
-		ret = reset_tree(new->commit->tree, opts, 1, writeout_error);
+		ret = reset_tree(new_branch_info->commit->tree, opts, 1, writeout_error);
 		if (ret)
 			return ret;
 	} else {
@@ -523,7 +523,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
 					   &old->commit->object.oid :
 					   the_hash_algo->empty_tree);
 		init_tree_desc(&trees[0], tree->buffer, tree->size);
-		tree = parse_tree_indirect(&new->commit->object.oid);
+		tree = parse_tree_indirect(&new_branch_info->commit->object.oid);
 		init_tree_desc(&trees[1], tree->buffer, tree->size);
 
 		ret = unpack_trees(2, trees, &topts);
@@ -571,18 +571,18 @@ static int merge_working_tree(const struct checkout_opts *opts,
 			o.verbosity = 0;
 			work = write_tree_from_memory(&o);
 
-			ret = reset_tree(new->commit->tree, opts, 1,
+			ret = reset_tree(new_branch_info->commit->tree, opts, 1,
 					 writeout_error);
 			if (ret)
 				return ret;
 			o.ancestor = old->name;
-			o.branch1 = new->name;
+			o.branch1 = new_branch_info->name;
 			o.branch2 = "local";
-			ret = merge_trees(&o, new->commit->tree, work,
+			ret = merge_trees(&o, new_branch_info->commit->tree, work,
 				old->commit->tree, &result);
 			if (ret < 0)
 				exit(128);
-			ret = reset_tree(new->commit->tree, opts, 0,
+			ret = reset_tree(new_branch_info->commit->tree, opts, 0,
 					 writeout_error);
 			strbuf_release(&o.obuf);
 			if (ret)
@@ -600,15 +600,15 @@ static int merge_working_tree(const struct checkout_opts *opts,
 		die(_("unable to write new index file"));
 
 	if (!opts->force && !opts->quiet)
-		show_local_changes(&new->commit->object, &opts->diff_options);
+		show_local_changes(&new_branch_info->commit->object, &opts->diff_options);
 
 	return 0;
 }
 
-static void report_tracking(struct branch_info *new)
+static void report_tracking(struct branch_info *new_branch_info)
 {
 	struct strbuf sb = STRBUF_INIT;
-	struct branch *branch = branch_get(new->name);
+	struct branch *branch = branch_get(new_branch_info->name);
 
 	if (!format_tracking_info(branch, &sb))
 		return;
@@ -618,7 +618,7 @@ static void report_tracking(struct branch_info *new)
 
 static void update_refs_for_switch(const struct checkout_opts *opts,
 				   struct branch_info *old,
-				   struct branch_info *new)
+				   struct branch_info *new_branch_info)
 {
 	struct strbuf msg = STRBUF_INIT;
 	const char *old_desc, *reflog_msg;
@@ -645,14 +645,14 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
 			free(refname);
 		}
 		else
-			create_branch(opts->new_branch, new->name,
+			create_branch(opts->new_branch, new_branch_info->name,
 				      opts->new_branch_force ? 1 : 0,
 				      opts->new_branch_force ? 1 : 0,
 				      opts->new_branch_log,
 				      opts->quiet,
 				      opts->track);
-		new->name = opts->new_branch;
-		setup_branch_path(new);
+		new_branch_info->name = opts->new_branch;
+		setup_branch_path(new_branch_info);
 	}
 
 	old_desc = old->name;
@@ -662,40 +662,40 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
 	reflog_msg = getenv("GIT_REFLOG_ACTION");
 	if (!reflog_msg)
 		strbuf_addf(&msg, "checkout: moving from %s to %s",
-			old_desc ? old_desc : "(invalid)", new->name);
+			old_desc ? old_desc : "(invalid)", new_branch_info->name);
 	else
 		strbuf_insert(&msg, 0, reflog_msg, strlen(reflog_msg));
 
-	if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
+	if (!strcmp(new_branch_info->name, "HEAD") && !new_branch_info->path && !opts->force_detach) {
 		/* Nothing to do. */
-	} else if (opts->force_detach || !new->path) {	/* No longer on any branch. */
-		update_ref(msg.buf, "HEAD", &new->commit->object.oid, NULL,
+	} else if (opts->force_detach || !new_branch_info->path) {	/* No longer on any branch. */
+		update_ref(msg.buf, "HEAD", &new_branch_info->commit->object.oid, NULL,
 			   REF_NO_DEREF, UPDATE_REFS_DIE_ON_ERR);
 		if (!opts->quiet) {
 			if (old->path &&
 			    advice_detached_head && !opts->force_detach)
-				detach_advice(new->name);
-			describe_detached_head(_("HEAD is now at"), new->commit);
+				detach_advice(new_branch_info->name);
+			describe_detached_head(_("HEAD is now at"), new_branch_info->commit);
 		}
-	} else if (new->path) {	/* Switch branches. */
-		if (create_symref("HEAD", new->path, msg.buf) < 0)
+	} else if (new_branch_info->path) {	/* Switch branches. */
+		if (create_symref("HEAD", new_branch_info->path, msg.buf) < 0)
 			die(_("unable to update HEAD"));
 		if (!opts->quiet) {
-			if (old->path && !strcmp(new->path, old->path)) {
+			if (old->path && !strcmp(new_branch_info->path, old->path)) {
 				if (opts->new_branch_force)
 					fprintf(stderr, _("Reset branch '%s'\n"),
-						new->name);
+						new_branch_info->name);
 				else
 					fprintf(stderr, _("Already on '%s'\n"),
-						new->name);
+						new_branch_info->name);
 			} else if (opts->new_branch) {
 				if (opts->branch_exists)
-					fprintf(stderr, _("Switched to and reset branch '%s'\n"), new->name);
+					fprintf(stderr, _("Switched to and reset branch '%s'\n"), new_branch_info->name);
 				else
-					fprintf(stderr, _("Switched to a new branch '%s'\n"), new->name);
+					fprintf(stderr, _("Switched to a new branch '%s'\n"), new_branch_info->name);
 			} else {
 				fprintf(stderr, _("Switched to branch '%s'\n"),
-					new->name);
+					new_branch_info->name);
 			}
 		}
 		if (old->path && old->name) {
@@ -706,8 +706,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
 	remove_branch_state();
 	strbuf_release(&msg);
 	if (!opts->quiet &&
-	    (new->path || (!opts->force_detach && !strcmp(new->name, "HEAD"))))
-		report_tracking(new);
+	    (new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, "HEAD"))))
+		report_tracking(new_branch_info);
 }
 
 static int add_pending_uninteresting_ref(const char *refname,
@@ -787,7 +787,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
  * HEAD.  If it is not reachable from any ref, this is the last chance
  * for the user to do so without resorting to reflog.
  */
-static void orphaned_commit_warning(struct commit *old, struct commit *new)
+static void orphaned_commit_warning(struct commit *old, struct commit *new_commit)
 {
 	struct rev_info revs;
 	struct object *object = &old->object;
@@ -799,7 +799,7 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)
 	add_pending_object(&revs, object, oid_to_hex(&object->oid));
 
 	for_each_ref(add_pending_uninteresting_ref, &revs);
-	add_pending_oid(&revs, "HEAD", &new->object.oid, UNINTERESTING);
+	add_pending_oid(&revs, "HEAD", &new_commit->object.oid, UNINTERESTING);
 
 	if (prepare_revision_walk(&revs))
 		die(_("internal error in revision walk"));
@@ -813,7 +813,7 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)
 }
 
 static int switch_branches(const struct checkout_opts *opts,
-			   struct branch_info *new)
+			   struct branch_info *new_branch_info)
 {
 	int ret = 0;
 	struct branch_info old;
@@ -830,26 +830,26 @@ static int switch_branches(const struct checkout_opts *opts,
 	if (old.path)
 		skip_prefix(old.path, "refs/heads/", &old.name);
 
-	if (!new->name) {
-		new->name = "HEAD";
-		new->commit = old.commit;
-		if (!new->commit)
+	if (!new_branch_info->name) {
+		new_branch_info->name = "HEAD";
+		new_branch_info->commit = old.commit;
+		if (!new_branch_info->commit)
 			die(_("You are on a branch yet to be born"));
-		parse_commit_or_die(new->commit);
+		parse_commit_or_die(new_branch_info->commit);
 	}
 
-	ret = merge_working_tree(opts, &old, new, &writeout_error);
+	ret = merge_working_tree(opts, &old, new_branch_info, &writeout_error);
 	if (ret) {
 		free(path_to_free);
 		return ret;
 	}
 
-	if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
-		orphaned_commit_warning(old.commit, new->commit);
+	if (!opts->quiet && !old.path && old.commit && new_branch_info->commit != old.commit)
+		orphaned_commit_warning(old.commit, new_branch_info->commit);
 
-	update_refs_for_switch(opts, &old, new);
+	update_refs_for_switch(opts, &old, new_branch_info);
 
-	ret = post_checkout_hook(old.commit, new->commit, 1);
+	ret = post_checkout_hook(old.commit, new_branch_info->commit, 1);
 	free(path_to_free);
 	return ret || writeout_error;
 }
@@ -870,7 +870,7 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
 
 static int parse_branchname_arg(int argc, const char **argv,
 				int dwim_new_local_branch_ok,
-				struct branch_info *new,
+				struct branch_info *new_branch_info,
 				struct checkout_opts *opts,
 				struct object_id *rev)
 {
@@ -988,22 +988,22 @@ static int parse_branchname_arg(int argc, const char **argv,
 	argv++;
 	argc--;
 
-	new->name = arg;
-	setup_branch_path(new);
+	new_branch_info->name = arg;
+	setup_branch_path(new_branch_info);
 
-	if (!check_refname_format(new->path, 0) &&
-	    !read_ref(new->path, &branch_rev))
+	if (!check_refname_format(new_branch_info->path, 0) &&
+	    !read_ref(new_branch_info->path, &branch_rev))
 		oidcpy(rev, &branch_rev);
 	else
-		new->path = NULL; /* not an existing branch */
+		new_branch_info->path = NULL; /* not an existing branch */
 
-	new->commit = lookup_commit_reference_gently(rev, 1);
-	if (!new->commit) {
+	new_branch_info->commit = lookup_commit_reference_gently(rev, 1);
+	if (!new_branch_info->commit) {
 		/* not a commit */
 		*source_tree = parse_tree_indirect(rev);
 	} else {
-		parse_commit_or_die(new->commit);
-		*source_tree = new->commit->tree;
+		parse_commit_or_die(new_branch_info->commit);
+		*source_tree = new_branch_info->commit->tree;
 	}
 
 	if (!*source_tree)                   /* case (1): want a tree */
@@ -1043,7 +1043,7 @@ static int switch_unborn_to_new_branch(const struct checkout_opts *opts)
 }
 
 static int checkout_branch(struct checkout_opts *opts,
-			   struct branch_info *new)
+			   struct branch_info *new_branch_info)
 {
 	if (opts->pathspec.nr)
 		die(_("paths cannot be used with switching branches"));
@@ -1072,21 +1072,21 @@ static int checkout_branch(struct checkout_opts *opts,
 	} else if (opts->track == BRANCH_TRACK_UNSPECIFIED)
 		opts->track = git_branch_track;
 
-	if (new->name && !new->commit)
+	if (new_branch_info->name && !new_branch_info->commit)
 		die(_("Cannot switch branch to a non-commit '%s'"),
-		    new->name);
+		    new_branch_info->name);
 
-	if (new->path && !opts->force_detach && !opts->new_branch &&
+	if (new_branch_info->path && !opts->force_detach && !opts->new_branch &&
 	    !opts->ignore_other_worktrees) {
 		int flag;
 		char *head_ref = resolve_refdup("HEAD", 0, NULL, &flag);
 		if (head_ref &&
-		    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))
-			die_if_checked_out(new->path, 1);
+		    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new_branch_info->path)))
+			die_if_checked_out(new_branch_info->path, 1);
 		free(head_ref);
 	}
 
-	if (!new->commit && opts->new_branch) {
+	if (!new_branch_info->commit && opts->new_branch) {
 		struct object_id rev;
 		int flag;
 
@@ -1094,13 +1094,13 @@ static int checkout_branch(struct checkout_opts *opts,
 		    (flag & REF_ISSYMREF) && is_null_oid(&rev))
 			return switch_unborn_to_new_branch(opts);
 	}
-	return switch_branches(opts, new);
+	return switch_branches(opts, new_branch_info);
 }
 
 int cmd_checkout(int argc, const char **argv, const char *prefix)
 {
 	struct checkout_opts opts;
-	struct branch_info new;
+	struct branch_info new_branch_info;
 	char *conflict_style = NULL;
 	int dwim_new_local_branch = 1;
 	struct option options[] = {
@@ -1138,7 +1138,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 	};
 
 	memset(&opts, 0, sizeof(opts));
-	memset(&new, 0, sizeof(new));
+	memset(&new_branch_info, 0, sizeof(new_branch_info));
 	opts.overwrite_ignore = 1;
 	opts.prefix = prefix;
 	opts.show_progress = -1;
@@ -1210,7 +1210,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 			opts.track == BRANCH_TRACK_UNSPECIFIED &&
 			!opts.new_branch;
 		int n = parse_branchname_arg(argc, argv, dwim_ok,
-					     &new, &opts, &rev);
+					     &new_branch_info, &opts, &rev);
 		argv += n;
 		argc -= n;
 	}
@@ -1253,7 +1253,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
 	UNLEAK(opts);
 	if (opts.patch_mode || opts.pathspec.nr)
-		return checkout_paths(&opts, new.name);
+		return checkout_paths(&opts, new_branch_info.name);
 	else
-		return checkout_branch(&opts, &new);
+		return checkout_branch(&opts, &new_branch_info);
 }
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 10/37] help: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (8 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 09/37] checkout: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 11/37] pack-redundant: " Brandon Williams
                   ` (29 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/help.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin/help.c b/builtin/help.c
index d3c8fc408..598867cfe 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -194,11 +194,11 @@ static void do_add_man_viewer_info(const char *name,
 				   size_t len,
 				   const char *value)
 {
-	struct man_viewer_info_list *new;
-	FLEX_ALLOC_MEM(new, name, name, len);
-	new->info = xstrdup(value);
-	new->next = man_viewer_info_list;
-	man_viewer_info_list = new;
+	struct man_viewer_info_list *new_man_viewer;
+	FLEX_ALLOC_MEM(new_man_viewer, name, name, len);
+	new_man_viewer->info = xstrdup(value);
+	new_man_viewer->next = man_viewer_info_list;
+	man_viewer_info_list = new_man_viewer;
 }
 
 static int add_man_viewer_path(const char *name,
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 11/37] pack-redundant: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (9 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 10/37] help: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 12/37] reflog: " Brandon Williams
                   ` (28 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/pack-redundant.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index aaa813632..e18b53df8 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -48,17 +48,17 @@ static inline void llist_item_put(struct llist_item *item)
 
 static inline struct llist_item *llist_item_get(void)
 {
-	struct llist_item *new;
+	struct llist_item *new_item;
 	if ( free_nodes ) {
-		new = free_nodes;
+		new_item = free_nodes;
 		free_nodes = free_nodes->next;
 	} else {
 		int i = 1;
-		ALLOC_ARRAY(new, BLKSIZE);
+		ALLOC_ARRAY(new_item, BLKSIZE);
 		for (; i < BLKSIZE; i++)
-			llist_item_put(&new[i]);
+			llist_item_put(&new_item[i]);
 	}
-	return new;
+	return new_item;
 }
 
 static void llist_free(struct llist *list)
@@ -80,26 +80,26 @@ static inline void llist_init(struct llist **list)
 static struct llist * llist_copy(struct llist *list)
 {
 	struct llist *ret;
-	struct llist_item *new, *old, *prev;
+	struct llist_item *new_item, *old, *prev;
 
 	llist_init(&ret);
 
 	if ((ret->size = list->size) == 0)
 		return ret;
 
-	new = ret->front = llist_item_get();
-	new->sha1 = list->front->sha1;
+	new_item = ret->front = llist_item_get();
+	new_item->sha1 = list->front->sha1;
 
 	old = list->front->next;
 	while (old) {
-		prev = new;
-		new = llist_item_get();
-		prev->next = new;
-		new->sha1 = old->sha1;
+		prev = new_item;
+		new_item = llist_item_get();
+		prev->next = new_item;
+		new_item->sha1 = old->sha1;
 		old = old->next;
 	}
-	new->next = NULL;
-	ret->back = new;
+	new_item->next = NULL;
+	ret->back = new_item;
 
 	return ret;
 }
@@ -108,24 +108,24 @@ static inline struct llist_item *llist_insert(struct llist *list,
 					      struct llist_item *after,
 					       const unsigned char *sha1)
 {
-	struct llist_item *new = llist_item_get();
-	new->sha1 = sha1;
-	new->next = NULL;
+	struct llist_item *new_item = llist_item_get();
+	new_item->sha1 = sha1;
+	new_item->next = NULL;
 
 	if (after != NULL) {
-		new->next = after->next;
-		after->next = new;
+		new_item->next = after->next;
+		after->next = new_item;
 		if (after == list->back)
-			list->back = new;
+			list->back = new_item;
 	} else {/* insert in front */
 		if (list->size == 0)
-			list->back = new;
+			list->back = new_item;
 		else
-			new->next = list->front;
-		list->front = new;
+			new_item->next = list->front;
+		list->front = new_item;
 	}
 	list->size++;
-	return new;
+	return new_item;
 }
 
 static inline struct llist_item *llist_insert_back(struct llist *list,
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 12/37] reflog: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (10 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 11/37] pack-redundant: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 13/37] remote: " Brandon Williams
                   ` (27 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/reflog.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/reflog.c b/builtin/reflog.c
index 223372531..c1bcab5c5 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -289,20 +289,20 @@ static int should_expire_reflog_ent(struct object_id *ooid, struct object_id *no
 				    const char *message, void *cb_data)
 {
 	struct expire_reflog_policy_cb *cb = cb_data;
-	struct commit *old, *new;
+	struct commit *old, *new_commit;
 
 	if (timestamp < cb->cmd.expire_total)
 		return 1;
 
-	old = new = NULL;
+	old = new_commit = NULL;
 	if (cb->cmd.stalefix &&
-	    (!keep_entry(&old, ooid) || !keep_entry(&new, noid)))
+	    (!keep_entry(&old, ooid) || !keep_entry(&new_commit, noid)))
 		return 1;
 
 	if (timestamp < cb->cmd.expire_unreachable) {
 		if (cb->unreachable_expire_kind == UE_ALWAYS)
 			return 1;
-		if (unreachable(cb, old, ooid) || unreachable(cb, new, noid))
+		if (unreachable(cb, old, ooid) || unreachable(cb, new_commit, noid))
 			return 1;
 	}
 
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 13/37] remote: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (11 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 12/37] reflog: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 14/37] combine-diff: " Brandon Williams
                   ` (26 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/remote.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/builtin/remote.c b/builtin/remote.c
index d95bf904c..4f4783e70 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -322,7 +322,7 @@ static void read_branches(void)
 
 struct ref_states {
 	struct remote *remote;
-	struct string_list new, stale, tracked, heads, push;
+	struct string_list new_refs, stale, tracked, heads, push;
 	int queried;
 };
 
@@ -337,12 +337,12 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
 			die(_("Could not get fetch map for refspec %s"),
 				states->remote->fetch_refspec[i]);
 
-	states->new.strdup_strings = 1;
+	states->new_refs.strdup_strings = 1;
 	states->tracked.strdup_strings = 1;
 	states->stale.strdup_strings = 1;
 	for (ref = fetch_map; ref; ref = ref->next) {
 		if (!ref->peer_ref || !ref_exists(ref->peer_ref->name))
-			string_list_append(&states->new, abbrev_branch(ref->name));
+			string_list_append(&states->new_refs, abbrev_branch(ref->name));
 		else
 			string_list_append(&states->tracked, abbrev_branch(ref->name));
 	}
@@ -356,7 +356,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
 	free_refs(stale_refs);
 	free_refs(fetch_map);
 
-	string_list_sort(&states->new);
+	string_list_sort(&states->new_refs);
 	string_list_sort(&states->tracked);
 	string_list_sort(&states->stale);
 
@@ -547,7 +547,7 @@ static int add_branch_for_removal(const char *refname,
 
 struct rename_info {
 	const char *old;
-	const char *new;
+	const char *new_name;
 	struct string_list *remote_branches;
 };
 
@@ -616,33 +616,33 @@ static int mv(int argc, const char **argv)
 		usage_with_options(builtin_remote_rename_usage, options);
 
 	rename.old = argv[1];
-	rename.new = argv[2];
+	rename.new_name = argv[2];
 	rename.remote_branches = &remote_branches;
 
 	oldremote = remote_get(rename.old);
 	if (!remote_is_configured(oldremote, 1))
 		die(_("No such remote: %s"), rename.old);
 
-	if (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)
+	if (!strcmp(rename.old, rename.new_name) && oldremote->origin != REMOTE_CONFIG)
 		return migrate_file(oldremote);
 
-	newremote = remote_get(rename.new);
+	newremote = remote_get(rename.new_name);
 	if (remote_is_configured(newremote, 1))
-		die(_("remote %s already exists."), rename.new);
+		die(_("remote %s already exists."), rename.new_name);
 
-	strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new);
+	strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new_name);
 	if (!valid_fetch_refspec(buf.buf))
-		die(_("'%s' is not a valid remote name"), rename.new);
+		die(_("'%s' is not a valid remote name"), rename.new_name);
 
 	strbuf_reset(&buf);
 	strbuf_addf(&buf, "remote.%s", rename.old);
-	strbuf_addf(&buf2, "remote.%s", rename.new);
+	strbuf_addf(&buf2, "remote.%s", rename.new_name);
 	if (git_config_rename_section(buf.buf, buf2.buf) < 1)
 		return error(_("Could not rename config section '%s' to '%s'"),
 				buf.buf, buf2.buf);
 
 	strbuf_reset(&buf);
-	strbuf_addf(&buf, "remote.%s.fetch", rename.new);
+	strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
 	git_config_set_multivar(buf.buf, NULL, NULL, 1);
 	strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
 	for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
@@ -655,8 +655,8 @@ static int mv(int argc, const char **argv)
 			refspec_updated = 1;
 			strbuf_splice(&buf2,
 				      ptr-buf2.buf + strlen(":refs/remotes/"),
-				      strlen(rename.old), rename.new,
-				      strlen(rename.new));
+				      strlen(rename.old), rename.new_name,
+				      strlen(rename.new_name));
 		} else
 			warning(_("Not updating non-default fetch refspec\n"
 				  "\t%s\n"
@@ -673,7 +673,7 @@ static int mv(int argc, const char **argv)
 		if (info->remote_name && !strcmp(info->remote_name, rename.old)) {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "branch.%s.remote", item->string);
-			git_config_set(buf.buf, rename.new);
+			git_config_set(buf.buf, rename.new_name);
 		}
 	}
 
@@ -704,7 +704,7 @@ static int mv(int argc, const char **argv)
 		strbuf_reset(&buf);
 		strbuf_addstr(&buf, item->string);
 		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf2);
 		strbuf_addf(&buf2, "remote: renamed %s to %s",
 				item->string, buf.buf);
@@ -719,11 +719,11 @@ static int mv(int argc, const char **argv)
 		strbuf_reset(&buf);
 		strbuf_addstr(&buf, item->string);
 		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf2);
 		strbuf_addstr(&buf2, item->util);
 		strbuf_splice(&buf2, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf3);
 		strbuf_addf(&buf3, "remote: renamed %s to %s",
 				item->string, buf.buf);
@@ -822,7 +822,7 @@ static void clear_push_info(void *util, const char *string)
 
 static void free_remote_ref_states(struct ref_states *states)
 {
-	string_list_clear(&states->new, 0);
+	string_list_clear(&states->new_refs, 0);
 	string_list_clear(&states->stale, 1);
 	string_list_clear(&states->tracked, 0);
 	string_list_clear(&states->heads, 0);
@@ -907,7 +907,7 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)
 	if (states->queried) {
 		const char *fmt = "%s";
 		const char *arg = "";
-		if (string_list_has_string(&states->new, name)) {
+		if (string_list_has_string(&states->new_refs, name)) {
 			fmt = _(" new (next fetch will store in remotes/%s)");
 			arg = states->remote->name;
 		} else if (string_list_has_string(&states->tracked, name))
@@ -1176,7 +1176,7 @@ static int show(int argc, const char **argv)
 
 		/* remote branch info */
 		info.width = 0;
-		for_each_string_list(&states.new, add_remote_to_show_info, &info);
+		for_each_string_list(&states.new_refs, add_remote_to_show_info, &info);
 		for_each_string_list(&states.tracked, add_remote_to_show_info, &info);
 		for_each_string_list(&states.stale, add_remote_to_show_info, &info);
 		if (info.list->nr)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 14/37] combine-diff: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (12 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 13/37] remote: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 15/37] commit: " Brandon Williams
                   ` (25 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 combine-diff.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index bc08c4c5b..14db48966 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -162,7 +162,7 @@ enum coalesce_direction { MATCH, BASE, NEW };
 
 /* Coalesce new lines into base by finding LCS */
 static struct lline *coalesce_lines(struct lline *base, int *lenbase,
-				    struct lline *new, int lennew,
+				    struct lline *newline, int lennew,
 				    unsigned long parent, long flags)
 {
 	int **lcs;
@@ -170,12 +170,12 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 	struct lline *baseend, *newend = NULL;
 	int i, j, origbaselen = *lenbase;
 
-	if (new == NULL)
+	if (newline == NULL)
 		return base;
 
 	if (base == NULL) {
 		*lenbase = lennew;
-		return new;
+		return newline;
 	}
 
 	/*
@@ -200,7 +200,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 		directions[0][j] = NEW;
 
 	for (i = 1, baseend = base; i < origbaselen + 1; i++) {
-		for (j = 1, newend = new; j < lennew + 1; j++) {
+		for (j = 1, newend = newline; j < lennew + 1; j++) {
 			if (match_string_spaces(baseend->line, baseend->len,
 						newend->line, newend->len, flags)) {
 				lcs[i][j] = lcs[i - 1][j - 1] + 1;
@@ -241,7 +241,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 			if (lline->prev)
 				lline->prev->next = lline->next;
 			else
-				new = lline->next;
+				newline = lline->next;
 			if (lline->next)
 				lline->next->prev = lline->prev;
 
@@ -270,7 +270,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 		}
 	}
 
-	newend = new;
+	newend = newline;
 	while (newend) {
 		struct lline *lline = newend;
 		newend = newend->next;
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 15/37] commit: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (13 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 14/37] combine-diff: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 16/37] diff-lib: rename 'new' variable Brandon Williams
                   ` (24 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 commit.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/commit.c b/commit.c
index cd9ace105..874b6e510 100644
--- a/commit.c
+++ b/commit.c
@@ -861,19 +861,19 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)
 	commit_list_insert(in->item, &ret);
 
 	for (i = in->next; i; i = i->next) {
-		struct commit_list *new = NULL, *end = NULL;
+		struct commit_list *new_commits = NULL, *end = NULL;
 
 		for (j = ret; j; j = j->next) {
 			struct commit_list *bases;
 			bases = get_merge_bases(i->item, j->item);
-			if (!new)
-				new = bases;
+			if (!new_commits)
+				new_commits = bases;
 			else
 				end->next = bases;
 			for (k = bases; k; k = k->next)
 				end = k;
 		}
-		ret = new;
+		ret = new_commits;
 	}
 	return ret;
 }
@@ -1617,11 +1617,11 @@ struct commit *get_merge_parent(const char *name)
 struct commit_list **commit_list_append(struct commit *commit,
 					struct commit_list **next)
 {
-	struct commit_list *new = xmalloc(sizeof(struct commit_list));
-	new->item = commit;
-	*next = new;
-	new->next = NULL;
-	return &new->next;
+	struct commit_list *new_commit = xmalloc(sizeof(struct commit_list));
+	new_commit->item = commit;
+	*next = new_commit;
+	new_commit->next = NULL;
+	return &new_commit->next;
 }
 
 const char *find_commit_header(const char *msg, const char *key, size_t *out_len)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 16/37] diff-lib: rename 'new' variable
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (14 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 15/37] commit: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 17/37] diff: rename 'new' variables Brandon Williams
                   ` (23 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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

diff --git a/diff-lib.c b/diff-lib.c
index 8104603a3..46375abb4 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -302,7 +302,7 @@ static int get_stat_data(const struct cache_entry *ce,
 }
 
 static void show_new_file(struct rev_info *revs,
-			  const struct cache_entry *new,
+			  const struct cache_entry *new_file,
 			  int cached, int match_missing)
 {
 	const struct object_id *oid;
@@ -313,16 +313,16 @@ static void show_new_file(struct rev_info *revs,
 	 * New file in the index: it might actually be different in
 	 * the working tree.
 	 */
-	if (get_stat_data(new, &oid, &mode, cached, match_missing,
+	if (get_stat_data(new_file, &oid, &mode, cached, match_missing,
 	    &dirty_submodule, &revs->diffopt) < 0)
 		return;
 
-	diff_index_show_file(revs, "+", new, oid, !is_null_oid(oid), mode, dirty_submodule);
+	diff_index_show_file(revs, "+", new_file, oid, !is_null_oid(oid), mode, dirty_submodule);
 }
 
 static int show_modified(struct rev_info *revs,
 			 const struct cache_entry *old,
-			 const struct cache_entry *new,
+			 const struct cache_entry *new_entry,
 			 int report_missing,
 			 int cached, int match_missing)
 {
@@ -330,7 +330,7 @@ static int show_modified(struct rev_info *revs,
 	const struct object_id *oid;
 	unsigned dirty_submodule = 0;
 
-	if (get_stat_data(new, &oid, &mode, cached, match_missing,
+	if (get_stat_data(new_entry, &oid, &mode, cached, match_missing,
 			  &dirty_submodule, &revs->diffopt) < 0) {
 		if (report_missing)
 			diff_index_show_file(revs, "-", old,
@@ -340,21 +340,21 @@ static int show_modified(struct rev_info *revs,
 	}
 
 	if (revs->combine_merges && !cached &&
-	    (oidcmp(oid, &old->oid) || oidcmp(&old->oid, &new->oid))) {
+	    (oidcmp(oid, &old->oid) || oidcmp(&old->oid, &new_entry->oid))) {
 		struct combine_diff_path *p;
-		int pathlen = ce_namelen(new);
+		int pathlen = ce_namelen(new_entry);
 
 		p = xmalloc(combine_diff_path_size(2, pathlen));
 		p->path = (char *) &p->parent[2];
 		p->next = NULL;
-		memcpy(p->path, new->name, pathlen);
+		memcpy(p->path, new_entry->name, pathlen);
 		p->path[pathlen] = 0;
 		p->mode = mode;
 		oidclr(&p->oid);
 		memset(p->parent, 0, 2 * sizeof(struct combine_diff_parent));
 		p->parent[0].status = DIFF_STATUS_MODIFIED;
-		p->parent[0].mode = new->ce_mode;
-		oidcpy(&p->parent[0].oid, &new->oid);
+		p->parent[0].mode = new_entry->ce_mode;
+		oidcpy(&p->parent[0].oid, &new_entry->oid);
 		p->parent[1].status = DIFF_STATUS_MODIFIED;
 		p->parent[1].mode = old->ce_mode;
 		oidcpy(&p->parent[1].oid, &old->oid);
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 17/37] diff: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (15 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 16/37] diff-lib: rename 'new' variable Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 18/37] diffcore-delta: " Brandon Williams
                   ` (22 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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

diff --git a/diff.c b/diff.c
index d682d0d1f..d49732b3b 100644
--- a/diff.c
+++ b/diff.c
@@ -1504,7 +1504,7 @@ struct diff_words_style_elem {
 
 struct diff_words_style {
 	enum diff_words_type type;
-	struct diff_words_style_elem new, old, ctx;
+	struct diff_words_style_elem new_word, old, ctx;
 	const char *newline;
 };
 
@@ -1660,7 +1660,7 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
 	}
 	if (plus_begin != plus_end) {
 		fn_out_diff_words_write_helper(diff_words->opt,
-				&style->new, style->newline,
+				&style->new_word, style->newline,
 				plus_end - plus_begin, plus_begin);
 	}
 
@@ -1884,7 +1884,7 @@ static void init_diff_words_data(struct emit_callback *ecbdata,
 	if (want_color(o->use_color)) {
 		struct diff_words_style *st = ecbdata->diff_words->style;
 		st->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);
-		st->new.color = diff_get_color_opt(o, DIFF_FILE_NEW);
+		st->new_word.color = diff_get_color_opt(o, DIFF_FILE_NEW);
 		st->ctx.color = diff_get_color_opt(o, DIFF_CONTEXT);
 	}
 }
@@ -2048,7 +2048,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
 static char *pprint_rename(const char *a, const char *b)
 {
 	const char *old = a;
-	const char *new = b;
+	const char *new_name = b;
 	struct strbuf name = STRBUF_INIT;
 	int pfx_length, sfx_length;
 	int pfx_adjust_for_slash;
@@ -2067,16 +2067,16 @@ static char *pprint_rename(const char *a, const char *b)
 
 	/* Find common prefix */
 	pfx_length = 0;
-	while (*old && *new && *old == *new) {
+	while (*old && *new_name && *old == *new_name) {
 		if (*old == '/')
 			pfx_length = old - a + 1;
 		old++;
-		new++;
+		new_name++;
 	}
 
 	/* Find common suffix */
 	old = a + len_a;
-	new = b + len_b;
+	new_name = b + len_b;
 	sfx_length = 0;
 	/*
 	 * If there is a common prefix, it must end in a slash.  In
@@ -2088,12 +2088,12 @@ static char *pprint_rename(const char *a, const char *b)
 	 */
 	pfx_adjust_for_slash = (pfx_length ? 1 : 0);
 	while (a + pfx_length - pfx_adjust_for_slash <= old &&
-	       b + pfx_length - pfx_adjust_for_slash <= new &&
-	       *old == *new) {
+	       b + pfx_length - pfx_adjust_for_slash <= new_name &&
+	       *old == *new_name) {
 		if (*old == '/')
 			sfx_length = len_a - (old - a);
 		old--;
-		new--;
+		new_name--;
 	}
 
 	/*
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 18/37] diffcore-delta: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (16 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 17/37] diff: rename 'new' variables Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 19/37] entry: " Brandon Williams
                   ` (21 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 diffcore-delta.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/diffcore-delta.c b/diffcore-delta.c
index ebe70fb06..c83d45a04 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -48,16 +48,16 @@ struct spanhash_top {
 
 static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
 {
-	struct spanhash_top *new;
+	struct spanhash_top *new_spanhash;
 	int i;
 	int osz = 1 << orig->alloc_log2;
 	int sz = osz << 1;
 
-	new = xmalloc(st_add(sizeof(*orig),
+	new_spanhash = xmalloc(st_add(sizeof(*orig),
 			     st_mult(sizeof(struct spanhash), sz)));
-	new->alloc_log2 = orig->alloc_log2 + 1;
-	new->free = INITIAL_FREE(new->alloc_log2);
-	memset(new->data, 0, sizeof(struct spanhash) * sz);
+	new_spanhash->alloc_log2 = orig->alloc_log2 + 1;
+	new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);
+	memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);
 	for (i = 0; i < osz; i++) {
 		struct spanhash *o = &(orig->data[i]);
 		int bucket;
@@ -65,11 +65,11 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
 			continue;
 		bucket = o->hashval & (sz - 1);
 		while (1) {
-			struct spanhash *h = &(new->data[bucket++]);
+			struct spanhash *h = &(new_spanhash->data[bucket++]);
 			if (!h->cnt) {
 				h->hashval = o->hashval;
 				h->cnt = o->cnt;
-				new->free--;
+				new_spanhash->free--;
 				break;
 			}
 			if (sz <= bucket)
@@ -77,7 +77,7 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
 		}
 	}
 	free(orig);
-	return new;
+	return new_spanhash;
 }
 
 static struct spanhash_top *add_spanhash(struct spanhash_top *top,
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 19/37] entry: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (17 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 18/37] diffcore-delta: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 20/37] http: " Brandon Williams
                   ` (20 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 20/37] http: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (18 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 19/37] entry: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 21/37] imap-send: " Brandon Williams
                   ` (19 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 http.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/http.c b/http.c
index 597771271..41cfa41a9 100644
--- a/http.c
+++ b/http.c
@@ -1194,14 +1194,14 @@ static struct fill_chain *fill_cfg;
 
 void add_fill_function(void *data, int (*fill)(void *))
 {
-	struct fill_chain *new = xmalloc(sizeof(*new));
+	struct fill_chain *new_fill = xmalloc(sizeof(*new_fill));
 	struct fill_chain **linkp = &fill_cfg;
-	new->data = data;
-	new->fill = fill;
-	new->next = NULL;
+	new_fill->data = data;
+	new_fill->fill = fill;
+	new_fill->next = NULL;
 	while (*linkp)
 		linkp = &(*linkp)->next;
-	*linkp = new;
+	*linkp = new_fill;
 }
 
 void fill_active_slots(void)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 21/37] imap-send: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (19 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 20/37] http: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 22/37] line-log: " Brandon Williams
                   ` (18 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 imap-send.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/imap-send.c b/imap-send.c
index 36c7c1b4f..ffb0a6eca 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1189,11 +1189,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
  */
 static void lf_to_crlf(struct strbuf *msg)
 {
-	char *new;
+	char *new_msg;
 	size_t i, j;
 	char lastc;
 
-	/* First pass: tally, in j, the size of the new string: */
+	/* First pass: tally, in j, the size of the new_msg string: */
 	for (i = j = 0, lastc = '\0'; i < msg->len; i++) {
 		if (msg->buf[i] == '\n' && lastc != '\r')
 			j++; /* a CR will need to be added here */
@@ -1201,18 +1201,18 @@ static void lf_to_crlf(struct strbuf *msg)
 		j++;
 	}
 
-	new = xmallocz(j);
+	new_msg = xmallocz(j);
 
 	/*
-	 * Second pass: write the new string.  Note that this loop is
+	 * Second pass: write the new_msg string.  Note that this loop is
 	 * otherwise identical to the first pass.
 	 */
 	for (i = j = 0, lastc = '\0'; i < msg->len; i++) {
 		if (msg->buf[i] == '\n' && lastc != '\r')
-			new[j++] = '\r';
-		lastc = new[j++] = msg->buf[i];
+			new_msg[j++] = '\r';
+		lastc = new_msg[j++] = msg->buf[i];
 	}
-	strbuf_attach(msg, new, j, j + 1);
+	strbuf_attach(msg, new_msg, j, j + 1);
 }
 
 /*
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 22/37] line-log: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (20 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 21/37] imap-send: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 23/37] read-cache: " Brandon Williams
                   ` (17 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 line-log.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/line-log.c b/line-log.c
index 545ad0f28..346664c3d 100644
--- a/line-log.c
+++ b/line-log.c
@@ -151,29 +151,29 @@ static void range_set_union(struct range_set *out,
 
 	assert(out->nr == 0);
 	while (i < a->nr || j < b->nr) {
-		struct range *new;
+		struct range *new_range;
 		if (i < a->nr && j < b->nr) {
 			if (ra[i].start < rb[j].start)
-				new = &ra[i++];
+				new_range = &ra[i++];
 			else if (ra[i].start > rb[j].start)
-				new = &rb[j++];
+				new_range = &rb[j++];
 			else if (ra[i].end < rb[j].end)
-				new = &ra[i++];
+				new_range = &ra[i++];
 			else
-				new = &rb[j++];
+				new_range = &rb[j++];
 		} else if (i < a->nr)      /* b exhausted */
-			new = &ra[i++];
+			new_range = &ra[i++];
 		else                       /* a exhausted */
-			new = &rb[j++];
-		if (new->start == new->end)
+			new_range = &rb[j++];
+		if (new_range->start == new_range->end)
 			; /* empty range */
-		else if (!out->nr || out->ranges[out->nr-1].end < new->start) {
+		else if (!out->nr || out->ranges[out->nr-1].end < new_range->start) {
 			range_set_grow(out, 1);
-			out->ranges[out->nr].start = new->start;
-			out->ranges[out->nr].end = new->end;
+			out->ranges[out->nr].start = new_range->start;
+			out->ranges[out->nr].end = new_range->end;
 			out->nr++;
-		} else if (out->ranges[out->nr-1].end < new->end) {
-			out->ranges[out->nr-1].end = new->end;
+		} else if (out->ranges[out->nr-1].end < new_range->end) {
+			out->ranges[out->nr-1].end = new_range->end;
 		}
 	}
 }
@@ -697,17 +697,17 @@ static void add_line_range(struct rev_info *revs, struct commit *commit,
 			   struct line_log_data *range)
 {
 	struct line_log_data *old = NULL;
-	struct line_log_data *new = NULL;
+	struct line_log_data *new_line = NULL;
 
 	old = lookup_decoration(&revs->line_log_data, &commit->object);
 	if (old && range) {
-		new = line_log_data_merge(old, range);
+		new_line = line_log_data_merge(old, range);
 		free_line_log_data(old);
 	} else if (range)
-		new = line_log_data_copy(range);
+		new_line = line_log_data_copy(range);
 
-	if (new)
-		add_decoration(&revs->line_log_data, &commit->object, new);
+	if (new_line)
+		add_decoration(&revs->line_log_data, &commit->object, new_line);
 }
 
 static void clear_commit_line_range(struct rev_info *revs, struct commit *commit)
@@ -1042,12 +1042,12 @@ static int process_diff_filepair(struct rev_info *rev,
 
 static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair)
 {
-	struct diff_filepair *new = xmalloc(sizeof(struct diff_filepair));
-	new->one = pair->one;
-	new->two = pair->two;
-	new->one->count++;
-	new->two->count++;
-	return new;
+	struct diff_filepair *new_filepair = xmalloc(sizeof(struct diff_filepair));
+	new_filepair->one = pair->one;
+	new_filepair->two = pair->two;
+	new_filepair->one->count++;
+	new_filepair->two->count++;
+	return new_filepair;
 }
 
 static void free_diffqueues(int n, struct diff_queue_struct *dq)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 23/37] read-cache: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (21 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 22/37] line-log: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 24/37] ref-filter: " Brandon Williams
                   ` (16 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 read-cache.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 2eb81a66b..21b859087 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -70,20 +70,20 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
 
 void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
 {
-	struct cache_entry *old = istate->cache[nr], *new;
+	struct cache_entry *old = istate->cache[nr], *new_entry;
 	int namelen = strlen(new_name);
 
-	new = xmalloc(cache_entry_size(namelen));
-	copy_cache_entry(new, old);
-	new->ce_flags &= ~CE_HASHED;
-	new->ce_namelen = namelen;
-	new->index = 0;
-	memcpy(new->name, new_name, namelen + 1);
+	new_entry = xmalloc(cache_entry_size(namelen));
+	copy_cache_entry(new_entry, old);
+	new_entry->ce_flags &= ~CE_HASHED;
+	new_entry->ce_namelen = namelen;
+	new_entry->index = 0;
+	memcpy(new_entry->name, new_name, namelen + 1);
 
 	cache_tree_invalidate_path(istate, old->name);
 	untracked_cache_remove_from_index(istate, old->name);
 	remove_index_entry_at(istate, nr);
-	add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+	add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
 }
 
 void fill_stat_data(struct stat_data *sd, struct stat *st)
@@ -615,18 +615,18 @@ static struct cache_entry *create_alias_ce(struct index_state *istate,
 					   struct cache_entry *alias)
 {
 	int len;
-	struct cache_entry *new;
+	struct cache_entry *new_entry;
 
 	if (alias->ce_flags & CE_ADDED)
 		die("Will not add file alias '%s' ('%s' already exists in index)", ce->name, alias->name);
 
 	/* Ok, create the new entry using the name of the existing alias */
 	len = ce_namelen(alias);
-	new = xcalloc(1, cache_entry_size(len));
-	memcpy(new->name, alias->name, len);
-	copy_cache_entry(new, ce);
+	new_entry = xcalloc(1, cache_entry_size(len));
+	memcpy(new_entry->name, alias->name, len);
+	copy_cache_entry(new_entry, ce);
 	save_or_free_index_entry(istate, ce);
-	return new;
+	return new_entry;
 }
 
 void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
@@ -1379,7 +1379,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
 	added_fmt = (in_porcelain ? "A\t%s\n" : "%s needs update\n");
 	unmerged_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
 	for (i = 0; i < istate->cache_nr; i++) {
-		struct cache_entry *ce, *new;
+		struct cache_entry *ce, *new_entry;
 		int cache_errno = 0;
 		int changed = 0;
 		int filtered = 0;
@@ -1408,10 +1408,10 @@ int refresh_index(struct index_state *istate, unsigned int flags,
 		if (filtered)
 			continue;
 
-		new = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);
-		if (new == ce)
+		new_entry = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);
+		if (new_entry == ce)
 			continue;
-		if (!new) {
+		if (!new_entry) {
 			const char *fmt;
 
 			if (really && cache_errno == EINVAL) {
@@ -1440,7 +1440,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
 			continue;
 		}
 
-		replace_index_entry(istate, i, new);
+		replace_index_entry(istate, i, new_entry);
 	}
 	return has_errors;
 }
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 24/37] ref-filter: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (22 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 23/37] read-cache: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 25/37] remote: " Brandon Williams
                   ` (15 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 ref-filter.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ref-filter.c b/ref-filter.c
index 9dae6cfe3..99a45beb1 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -529,12 +529,12 @@ static void end_align_handler(struct ref_formatting_stack **stack)
 
 static void align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
 {
-	struct ref_formatting_stack *new;
+	struct ref_formatting_stack *new_stack;
 
 	push_stack_element(&state->stack);
-	new = state->stack;
-	new->at_end = end_align_handler;
-	new->at_end_data = &atomv->atom->u.align;
+	new_stack = state->stack;
+	new_stack->at_end = end_align_handler;
+	new_stack->at_end_data = &atomv->atom->u.align;
 }
 
 static void if_then_else_handler(struct ref_formatting_stack **stack)
@@ -574,16 +574,16 @@ static void if_then_else_handler(struct ref_formatting_stack **stack)
 
 static void if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
 {
-	struct ref_formatting_stack *new;
+	struct ref_formatting_stack *new_stack;
 	struct if_then_else *if_then_else = xcalloc(sizeof(struct if_then_else), 1);
 
 	if_then_else->str = atomv->atom->u.if_then_else.str;
 	if_then_else->cmp_status = atomv->atom->u.if_then_else.cmp_status;
 
 	push_stack_element(&state->stack);
-	new = state->stack;
-	new->at_end = if_then_else_handler;
-	new->at_end_data = if_then_else;
+	new_stack = state->stack;
+	new_stack->at_end = if_then_else_handler;
+	new_stack->at_end_data = if_then_else;
 }
 
 static int is_empty(const char *s)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 25/37] remote: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (23 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 24/37] ref-filter: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 26/37] split-index: " Brandon Williams
                   ` (14 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 remote.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/remote.c b/remote.c
index 4e93753e1..6f79881f6 100644
--- a/remote.c
+++ b/remote.c
@@ -1970,12 +1970,12 @@ static void unmark_and_free(struct commit_list *list, unsigned int mark)
 int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
 {
 	struct object *o;
-	struct commit *old, *new;
+	struct commit *old, *new_commit;
 	struct commit_list *list, *used;
 	int found = 0;
 
 	/*
-	 * Both new and old must be commit-ish and new is descendant of
+	 * Both new_commit and old must be commit-ish and new_commit is descendant of
 	 * old.  Otherwise we require --force.
 	 */
 	o = deref_tag(parse_object(old_oid), NULL, 0);
@@ -1986,17 +1986,17 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
 	o = deref_tag(parse_object(new_oid), NULL, 0);
 	if (!o || o->type != OBJ_COMMIT)
 		return 0;
-	new = (struct commit *) o;
+	new_commit = (struct commit *) o;
 
-	if (parse_commit(new) < 0)
+	if (parse_commit(new_commit) < 0)
 		return 0;
 
 	used = list = NULL;
-	commit_list_insert(new, &list);
+	commit_list_insert(new_commit, &list);
 	while (list) {
-		new = pop_most_recent_commit(&list, TMP_MARK);
-		commit_list_insert(new, &used);
-		if (new == old) {
+		new_commit = pop_most_recent_commit(&list, TMP_MARK);
+		commit_list_insert(new_commit, &used);
+		if (new_commit == old) {
 			found = 1;
 			break;
 		}
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 26/37] split-index: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (24 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 25/37] remote: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 27/37] submodule: " Brandon Williams
                   ` (13 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 split-index.c | 10 +++++-----
 split-index.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/split-index.c b/split-index.c
index 83e39ec8d..8ae4bee89 100644
--- a/split-index.c
+++ b/split-index.c
@@ -304,16 +304,16 @@ void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce
 
 void replace_index_entry_in_base(struct index_state *istate,
 				 struct cache_entry *old,
-				 struct cache_entry *new)
+				 struct cache_entry *new_entry)
 {
 	if (old->index &&
 	    istate->split_index &&
 	    istate->split_index->base &&
 	    old->index <= istate->split_index->base->cache_nr) {
-		new->index = old->index;
-		if (old != istate->split_index->base->cache[new->index - 1])
-			free(istate->split_index->base->cache[new->index - 1]);
-		istate->split_index->base->cache[new->index - 1] = new;
+		new_entry->index = old->index;
+		if (old != istate->split_index->base->cache[new_entry->index - 1])
+			free(istate->split_index->base->cache[new_entry->index - 1]);
+		istate->split_index->base->cache[new_entry->index - 1] = new_entry;
 	}
 }
 
diff --git a/split-index.h b/split-index.h
index df91c1bda..43d66826e 100644
--- a/split-index.h
+++ b/split-index.h
@@ -21,7 +21,7 @@ struct split_index *init_split_index(struct index_state *istate);
 void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce);
 void replace_index_entry_in_base(struct index_state *istate,
 				 struct cache_entry *old,
-				 struct cache_entry *new);
+				 struct cache_entry *new_entry);
 int read_link_extension(struct index_state *istate,
 			const void *data, unsigned long sz);
 int write_link_extension(struct strbuf *sb,
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 27/37] submodule: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (25 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 26/37] split-index: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 28/37] trailer: " Brandon Williams
                   ` (12 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 submodule.c | 14 +++++++-------
 submodule.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/submodule.c b/submodule.c
index cd18400e8..244c3c21b 100644
--- a/submodule.c
+++ b/submodule.c
@@ -590,7 +590,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 		struct object_id *one, struct object_id *two,
 		unsigned dirty_submodule)
 {
-	const struct object_id *old = the_hash_algo->empty_tree, *new = the_hash_algo->empty_tree;
+	const struct object_id *old = the_hash_algo->empty_tree, *new_oid = the_hash_algo->empty_tree;
 	struct commit *left = NULL, *right = NULL;
 	struct commit_list *merge_bases = NULL;
 	struct child_process cp = CHILD_PROCESS_INIT;
@@ -607,7 +607,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 	if (left)
 		old = one;
 	if (right)
-		new = two;
+		new_oid = two;
 
 	cp.git_cmd = 1;
 	cp.dir = path;
@@ -638,7 +638,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 	 * haven't yet been committed to the submodule yet.
 	 */
 	if (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))
-		argv_array_push(&cp.args, oid_to_hex(new));
+		argv_array_push(&cp.args, oid_to_hex(new_oid));
 
 	prepare_submodule_repo_env(&cp.env_array);
 	if (start_command(&cp))
@@ -1579,7 +1579,7 @@ static void submodule_reset_index(const char *path)
  */
 int submodule_move_head(const char *path,
 			 const char *old,
-			 const char *new,
+			 const char *new_head,
 			 unsigned flags)
 {
 	int ret = 0;
@@ -1660,7 +1660,7 @@ int submodule_move_head(const char *path,
 	if (!(flags & SUBMODULE_MOVE_HEAD_FORCE))
 		argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
 
-	argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
+	argv_array_push(&cp.args, new_head ? new_head : EMPTY_TREE_SHA1_HEX);
 
 	if (run_command(&cp)) {
 		ret = -1;
@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,
 	}
 
 	if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
-		if (new) {
+		if (new_head) {
 			child_process_init(&cp);
 			/* also set the HEAD accordingly */
 			cp.git_cmd = 1;
@@ -1677,7 +1677,7 @@ int submodule_move_head(const char *path,
 
 			prepare_submodule_repo_env(&cp.env_array);
 			argv_array_pushl(&cp.args, "update-ref", "HEAD",
-					 "--no-deref", new, NULL);
+					 "--no-deref", new_head, NULL);
 
 			if (run_command(&cp)) {
 				ret = -1;
diff --git a/submodule.h b/submodule.h
index b9b7ef003..9589f1312 100644
--- a/submodule.h
+++ b/submodule.h
@@ -117,7 +117,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule);
 #define SUBMODULE_MOVE_HEAD_FORCE   (1<<1)
 extern int submodule_move_head(const char *path,
 			       const char *old,
-			       const char *new,
+			       const char *new_head,
 			       unsigned flags);
 
 /*
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 28/37] trailer: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (26 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 27/37] submodule: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 29/37] unpack-trees: " Brandon Williams
                   ` (11 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 trailer.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/trailer.c b/trailer.c
index 3ba157ed0..5a4a2ecf9 100644
--- a/trailer.c
+++ b/trailer.c
@@ -174,12 +174,12 @@ static void print_all(FILE *outfile, struct list_head *head,
 
 static struct trailer_item *trailer_from_arg(struct arg_item *arg_tok)
 {
-	struct trailer_item *new = xcalloc(sizeof(*new), 1);
-	new->token = arg_tok->token;
-	new->value = arg_tok->value;
+	struct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);
+	new_item->token = arg_tok->token;
+	new_item->value = arg_tok->value;
 	arg_tok->token = arg_tok->value = NULL;
 	free_arg_item(arg_tok);
-	return new;
+	return new_item;
 }
 
 static void add_arg_to_input_list(struct trailer_item *on_tok,
@@ -666,30 +666,30 @@ static void parse_trailer(struct strbuf *tok, struct strbuf *val,
 static struct trailer_item *add_trailer_item(struct list_head *head, char *tok,
 					     char *val)
 {
-	struct trailer_item *new = xcalloc(sizeof(*new), 1);
-	new->token = tok;
-	new->value = val;
-	list_add_tail(&new->list, head);
-	return new;
+	struct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);
+	new_item->token = tok;
+	new_item->value = val;
+	list_add_tail(&new_item->list, head);
+	return new_item;
 }
 
 static void add_arg_item(struct list_head *arg_head, char *tok, char *val,
 			 const struct conf_info *conf,
 			 const struct new_trailer_item *new_trailer_item)
 {
-	struct arg_item *new = xcalloc(sizeof(*new), 1);
-	new->token = tok;
-	new->value = val;
-	duplicate_conf(&new->conf, conf);
+	struct arg_item *new_item = xcalloc(sizeof(*new_item), 1);
+	new_item->token = tok;
+	new_item->value = val;
+	duplicate_conf(&new_item->conf, conf);
 	if (new_trailer_item) {
 		if (new_trailer_item->where != WHERE_DEFAULT)
-			new->conf.where = new_trailer_item->where;
+			new_item->conf.where = new_trailer_item->where;
 		if (new_trailer_item->if_exists != EXISTS_DEFAULT)
-			new->conf.if_exists = new_trailer_item->if_exists;
+			new_item->conf.if_exists = new_trailer_item->if_exists;
 		if (new_trailer_item->if_missing != MISSING_DEFAULT)
-			new->conf.if_missing = new_trailer_item->if_missing;
+			new_item->conf.if_missing = new_trailer_item->if_missing;
 	}
-	list_add_tail(&new->list, arg_head);
+	list_add_tail(&new_item->list, arg_head);
 }
 
 static void process_command_line_args(struct list_head *arg_head,
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 29/37] unpack-trees: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (27 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 28/37] trailer: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 30/37] init-db: rename 'template' variables Brandon Williams
                   ` (10 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 unpack-trees.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index 96c3327f1..bdedabcd5 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -194,10 +194,10 @@ static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
 static struct cache_entry *dup_entry(const struct cache_entry *ce)
 {
 	unsigned int size = ce_size(ce);
-	struct cache_entry *new = xmalloc(size);
+	struct cache_entry *new_entry = xmalloc(size);
 
-	memcpy(new, ce, size);
-	return new;
+	memcpy(new_entry, ce, size);
+	return new_entry;
 }
 
 static void add_entry(struct unpack_trees_options *o,
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 30/37] init-db: rename 'template' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (28 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 29/37] unpack-trees: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 31/37] environment: " Brandon Williams
                   ` (9 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/init-db.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index c9b7946ba..68ff4ad75 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -24,11 +24,11 @@ static int init_is_bare_repository = 0;
 static int init_shared_repository = -1;
 static const char *init_db_template_dir;
 
-static void copy_templates_1(struct strbuf *path, struct strbuf *template,
+static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
 			     DIR *dir)
 {
 	size_t path_baselen = path->len;
-	size_t template_baselen = template->len;
+	size_t template_baselen = template_path->len;
 	struct dirent *de;
 
 	/* Note: if ".git/hooks" file exists in the repository being
@@ -44,12 +44,12 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,
 		int exists = 0;
 
 		strbuf_setlen(path, path_baselen);
-		strbuf_setlen(template, template_baselen);
+		strbuf_setlen(template_path, template_baselen);
 
 		if (de->d_name[0] == '.')
 			continue;
 		strbuf_addstr(path, de->d_name);
-		strbuf_addstr(template, de->d_name);
+		strbuf_addstr(template_path, de->d_name);
 		if (lstat(path->buf, &st_git)) {
 			if (errno != ENOENT)
 				die_errno(_("cannot stat '%s'"), path->buf);
@@ -57,36 +57,36 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,
 		else
 			exists = 1;
 
-		if (lstat(template->buf, &st_template))
-			die_errno(_("cannot stat template '%s'"), template->buf);
+		if (lstat(template_path->buf, &st_template))
+			die_errno(_("cannot stat template '%s'"), template_path->buf);
 
 		if (S_ISDIR(st_template.st_mode)) {
-			DIR *subdir = opendir(template->buf);
+			DIR *subdir = opendir(template_path->buf);
 			if (!subdir)
-				die_errno(_("cannot opendir '%s'"), template->buf);
+				die_errno(_("cannot opendir '%s'"), template_path->buf);
 			strbuf_addch(path, '/');
-			strbuf_addch(template, '/');
-			copy_templates_1(path, template, subdir);
+			strbuf_addch(template_path, '/');
+			copy_templates_1(path, template_path, subdir);
 			closedir(subdir);
 		}
 		else if (exists)
 			continue;
 		else if (S_ISLNK(st_template.st_mode)) {
 			struct strbuf lnk = STRBUF_INIT;
-			if (strbuf_readlink(&lnk, template->buf, 0) < 0)
-				die_errno(_("cannot readlink '%s'"), template->buf);
+			if (strbuf_readlink(&lnk, template_path->buf, 0) < 0)
+				die_errno(_("cannot readlink '%s'"), template_path->buf);
 			if (symlink(lnk.buf, path->buf))
 				die_errno(_("cannot symlink '%s' '%s'"),
 					  lnk.buf, path->buf);
 			strbuf_release(&lnk);
 		}
 		else if (S_ISREG(st_template.st_mode)) {
-			if (copy_file(path->buf, template->buf, st_template.st_mode))
+			if (copy_file(path->buf, template_path->buf, st_template.st_mode))
 				die_errno(_("cannot copy '%s' to '%s'"),
-					  template->buf, path->buf);
+					  template_path->buf, path->buf);
 		}
 		else
-			error(_("ignoring template %s"), template->buf);
+			error(_("ignoring template %s"), template_path->buf);
 	}
 }
 
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 31/37] environment: rename 'template' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (29 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 30/37] init-db: rename 'template' variables Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 32/37] diff: " Brandon Williams
                   ` (8 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 cache.h       |  2 +-
 environment.c | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cache.h b/cache.h
index 69b5a3bf8..5b8d49377 100644
--- a/cache.h
+++ b/cache.h
@@ -1673,7 +1673,7 @@ struct pack_entry {
  * usual "XXXXXX" trailer, and the resulting filename is written into the
  * "template" buffer. Returns the open descriptor.
  */
-extern int odb_mkstemp(struct strbuf *template, const char *pattern);
+extern int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);
 
 /*
  * Create a pack .keep file named "name" (which should generally be the output
diff --git a/environment.c b/environment.c
index 63ac38a46..98f77ea95 100644
--- a/environment.c
+++ b/environment.c
@@ -247,7 +247,7 @@ char *get_object_directory(void)
 	return the_repository->objectdir;
 }
 
-int odb_mkstemp(struct strbuf *template, const char *pattern)
+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)
 {
 	int fd;
 	/*
@@ -255,16 +255,16 @@ int odb_mkstemp(struct strbuf *template, const char *pattern)
 	 * restrictive except to remove write permission.
 	 */
 	int mode = 0444;
-	git_path_buf(template, "objects/%s", pattern);
-	fd = git_mkstemp_mode(template->buf, mode);
+	git_path_buf(temp_filename, "objects/%s", pattern);
+	fd = git_mkstemp_mode(temp_filename->buf, mode);
 	if (0 <= fd)
 		return fd;
 
 	/* slow path */
-	/* some mkstemp implementations erase template on failure */
-	git_path_buf(template, "objects/%s", pattern);
-	safe_create_leading_directories(template->buf);
-	return xmkstemp_mode(template->buf, mode);
+	/* some mkstemp implementations erase temp_filename on failure */
+	git_path_buf(temp_filename, "objects/%s", pattern);
+	safe_create_leading_directories(temp_filename->buf);
+	return xmkstemp_mode(temp_filename->buf, mode);
 }
 
 int odb_pack_keep(const char *name)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 32/37] diff: rename 'template' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (30 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 31/37] environment: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 33/37] environment: rename 'namespace' variables Brandon Williams
                   ` (7 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 diff.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/diff.c b/diff.c
index d49732b3b..142a633e1 100644
--- a/diff.c
+++ b/diff.c
@@ -3660,15 +3660,15 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
 			   int mode)
 {
 	struct strbuf buf = STRBUF_INIT;
-	struct strbuf template = STRBUF_INIT;
+	struct strbuf tempfile = STRBUF_INIT;
 	char *path_dup = xstrdup(path);
 	const char *base = basename(path_dup);
 
 	/* Generate "XXXXXX_basename.ext" */
-	strbuf_addstr(&template, "XXXXXX_");
-	strbuf_addstr(&template, base);
+	strbuf_addstr(&tempfile, "XXXXXX_");
+	strbuf_addstr(&tempfile, base);
 
-	temp->tempfile = mks_tempfile_ts(template.buf, strlen(base) + 1);
+	temp->tempfile = mks_tempfile_ts(tempfile.buf, strlen(base) + 1);
 	if (!temp->tempfile)
 		die_errno("unable to create temp-file");
 	if (convert_to_working_tree(path,
@@ -3683,7 +3683,7 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
 	oid_to_hex_r(temp->hex, oid);
 	xsnprintf(temp->mode, sizeof(temp->mode), "%06o", mode);
 	strbuf_release(&buf);
-	strbuf_release(&template);
+	strbuf_release(&tempfile);
 	free(path_dup);
 }
 
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 33/37] environment: rename 'namespace' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (31 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 32/37] diff: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 34/37] wrapper: rename 'template' variables Brandon Williams
                   ` (6 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 environment.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/environment.c b/environment.c
index 98f77ea95..270ba98b5 100644
--- a/environment.c
+++ b/environment.c
@@ -98,7 +98,7 @@ int ignore_untracked_cache_config;
 /* This is set by setup_git_dir_gently() and/or git_default_config() */
 char *git_work_tree_cfg;
 
-static char *namespace;
+static char *git_namespace;
 
 static const char *super_prefix;
 
@@ -156,8 +156,8 @@ void setup_git_env(void)
 	free(git_replace_ref_base);
 	git_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base
 							  : "refs/replace/");
-	free(namespace);
-	namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
+	free(git_namespace);
+	git_namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
 	shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);
 	if (shallow_file)
 		set_alternate_shallow_file(shallow_file, 0);
@@ -191,9 +191,9 @@ const char *get_git_common_dir(void)
 
 const char *get_git_namespace(void)
 {
-	if (!namespace)
+	if (!git_namespace)
 		BUG("git environment hasn't been setup");
-	return namespace;
+	return git_namespace;
 }
 
 const char *strip_namespace(const char *namespaced_ref)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 34/37] wrapper: rename 'template' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (32 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 33/37] environment: rename 'namespace' variables Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 35/37] tempfile: " Brandon Williams
                   ` (5 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 git-compat-util.h |  4 ++--
 wrapper.c         | 40 ++++++++++++++++++++--------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 68b2ad531..07e383257 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -826,8 +826,8 @@ extern ssize_t xpread(int fd, void *buf, size_t len, off_t offset);
 extern int xdup(int fd);
 extern FILE *xfopen(const char *path, const char *mode);
 extern FILE *xfdopen(int fd, const char *mode);
-extern int xmkstemp(char *template);
-extern int xmkstemp_mode(char *template, int mode);
+extern int xmkstemp(char *temp_filename);
+extern int xmkstemp_mode(char *temp_filename, int mode);
 extern char *xgetcwd(void);
 extern FILE *fopen_for_writing(const char *path);
 extern FILE *fopen_or_warn(const char *path, const char *mode);
diff --git a/wrapper.c b/wrapper.c
index d20356a77..1fd5e33ea 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -445,21 +445,21 @@ FILE *fopen_or_warn(const char *path, const char *mode)
 	return NULL;
 }
 
-int xmkstemp(char *template)
+int xmkstemp(char *filename_template)
 {
 	int fd;
 	char origtemplate[PATH_MAX];
-	strlcpy(origtemplate, template, sizeof(origtemplate));
+	strlcpy(origtemplate, filename_template, sizeof(origtemplate));
 
-	fd = mkstemp(template);
+	fd = mkstemp(filename_template);
 	if (fd < 0) {
 		int saved_errno = errno;
 		const char *nonrelative_template;
 
-		if (strlen(template) != strlen(origtemplate))
-			template = origtemplate;
+		if (strlen(filename_template) != strlen(origtemplate))
+			filename_template = origtemplate;
 
-		nonrelative_template = absolute_path(template);
+		nonrelative_template = absolute_path(filename_template);
 		errno = saved_errno;
 		die_errno("Unable to create temporary file '%s'",
 			nonrelative_template);
@@ -481,7 +481,7 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
 	static const int num_letters = 62;
 	uint64_t value;
 	struct timeval tv;
-	char *template;
+	char *filename_template;
 	size_t len;
 	int fd, count;
 
@@ -503,16 +503,16 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
 	 */
 	gettimeofday(&tv, NULL);
 	value = ((size_t)(tv.tv_usec << 16)) ^ tv.tv_sec ^ getpid();
-	template = &pattern[len - 6 - suffix_len];
+	filename_template = &pattern[len - 6 - suffix_len];
 	for (count = 0; count < TMP_MAX; ++count) {
 		uint64_t v = value;
 		/* Fill in the random bits. */
-		template[0] = letters[v % num_letters]; v /= num_letters;
-		template[1] = letters[v % num_letters]; v /= num_letters;
-		template[2] = letters[v % num_letters]; v /= num_letters;
-		template[3] = letters[v % num_letters]; v /= num_letters;
-		template[4] = letters[v % num_letters]; v /= num_letters;
-		template[5] = letters[v % num_letters]; v /= num_letters;
+		filename_template[0] = letters[v % num_letters]; v /= num_letters;
+		filename_template[1] = letters[v % num_letters]; v /= num_letters;
+		filename_template[2] = letters[v % num_letters]; v /= num_letters;
+		filename_template[3] = letters[v % num_letters]; v /= num_letters;
+		filename_template[4] = letters[v % num_letters]; v /= num_letters;
+		filename_template[5] = letters[v % num_letters]; v /= num_letters;
 
 		fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);
 		if (fd >= 0)
@@ -541,21 +541,21 @@ int git_mkstemp_mode(char *pattern, int mode)
 	return git_mkstemps_mode(pattern, 0, mode);
 }
 
-int xmkstemp_mode(char *template, int mode)
+int xmkstemp_mode(char *filename_template, int mode)
 {
 	int fd;
 	char origtemplate[PATH_MAX];
-	strlcpy(origtemplate, template, sizeof(origtemplate));
+	strlcpy(origtemplate, filename_template, sizeof(origtemplate));
 
-	fd = git_mkstemp_mode(template, mode);
+	fd = git_mkstemp_mode(filename_template, mode);
 	if (fd < 0) {
 		int saved_errno = errno;
 		const char *nonrelative_template;
 
-		if (!template[0])
-			template = origtemplate;
+		if (!filename_template[0])
+			filename_template = origtemplate;
 
-		nonrelative_template = absolute_path(template);
+		nonrelative_template = absolute_path(filename_template);
 		errno = saved_errno;
 		die_errno("Unable to create temporary file '%s'",
 			nonrelative_template);
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 35/37] tempfile: rename 'template' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (33 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 34/37] wrapper: rename 'template' variables Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 36/37] trailer: " Brandon Williams
                   ` (4 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 tempfile.c | 12 ++++++------
 tempfile.h | 34 +++++++++++++++++-----------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/tempfile.c b/tempfile.c
index 5fdafdd2d..139ecd97f 100644
--- a/tempfile.c
+++ b/tempfile.c
@@ -165,11 +165,11 @@ struct tempfile *register_tempfile(const char *path)
 	return tempfile;
 }
 
-struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)
+struct tempfile *mks_tempfile_sm(const char *filename_template, int suffixlen, int mode)
 {
 	struct tempfile *tempfile = new_tempfile();
 
-	strbuf_add_absolute_path(&tempfile->filename, template);
+	strbuf_add_absolute_path(&tempfile->filename, filename_template);
 	tempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);
 	if (tempfile->fd < 0) {
 		deactivate_tempfile(tempfile);
@@ -179,7 +179,7 @@ struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)
 	return tempfile;
 }
 
-struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)
+struct tempfile *mks_tempfile_tsm(const char *filename_template, int suffixlen, int mode)
 {
 	struct tempfile *tempfile = new_tempfile();
 	const char *tmpdir;
@@ -188,7 +188,7 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)
 	if (!tmpdir)
 		tmpdir = "/tmp";
 
-	strbuf_addf(&tempfile->filename, "%s/%s", tmpdir, template);
+	strbuf_addf(&tempfile->filename, "%s/%s", tmpdir, filename_template);
 	tempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);
 	if (tempfile->fd < 0) {
 		deactivate_tempfile(tempfile);
@@ -198,12 +198,12 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)
 	return tempfile;
 }
 
-struct tempfile *xmks_tempfile_m(const char *template, int mode)
+struct tempfile *xmks_tempfile_m(const char *filename_template, int mode)
 {
 	struct tempfile *tempfile;
 	struct strbuf full_template = STRBUF_INIT;
 
-	strbuf_add_absolute_path(&full_template, template);
+	strbuf_add_absolute_path(&full_template, filename_template);
 	tempfile = mks_tempfile_m(full_template.buf, mode);
 	if (!tempfile)
 		die_errno("Unable to create temporary file '%s'",
diff --git a/tempfile.h b/tempfile.h
index 450908b2e..8959c5f1b 100644
--- a/tempfile.h
+++ b/tempfile.h
@@ -135,58 +135,58 @@ extern struct tempfile *register_tempfile(const char *path);
  */
 
 /* See "mks_tempfile functions" above. */
-extern struct tempfile *mks_tempfile_sm(const char *template,
+extern struct tempfile *mks_tempfile_sm(const char *filename_template,
 					int suffixlen, int mode);
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_s(const char *template,
+static inline struct tempfile *mks_tempfile_s(const char *filename_template,
 					      int suffixlen)
 {
-	return mks_tempfile_sm(template, suffixlen, 0600);
+	return mks_tempfile_sm(filename_template, suffixlen, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_m(const char *template, int mode)
+static inline struct tempfile *mks_tempfile_m(const char *filename_template, int mode)
 {
-	return mks_tempfile_sm(template, 0, mode);
+	return mks_tempfile_sm(filename_template, 0, mode);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile(const char *template)
+static inline struct tempfile *mks_tempfile(const char *filename_template)
 {
-	return mks_tempfile_sm(template, 0, 0600);
+	return mks_tempfile_sm(filename_template, 0, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-extern struct tempfile *mks_tempfile_tsm(const char *template,
+extern struct tempfile *mks_tempfile_tsm(const char *filename_template,
 					 int suffixlen, int mode);
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_ts(const char *template,
+static inline struct tempfile *mks_tempfile_ts(const char *filename_template,
 					       int suffixlen)
 {
-	return mks_tempfile_tsm(template, suffixlen, 0600);
+	return mks_tempfile_tsm(filename_template, suffixlen, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_tm(const char *template, int mode)
+static inline struct tempfile *mks_tempfile_tm(const char *filename_template, int mode)
 {
-	return mks_tempfile_tsm(template, 0, mode);
+	return mks_tempfile_tsm(filename_template, 0, mode);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_t(const char *template)
+static inline struct tempfile *mks_tempfile_t(const char *filename_template)
 {
-	return mks_tempfile_tsm(template, 0, 0600);
+	return mks_tempfile_tsm(filename_template, 0, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-extern struct tempfile *xmks_tempfile_m(const char *template, int mode);
+extern struct tempfile *xmks_tempfile_m(const char *filename_template, int mode);
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *xmks_tempfile(const char *template)
+static inline struct tempfile *xmks_tempfile(const char *filename_template)
 {
-	return xmks_tempfile_m(template, 0600);
+	return xmks_tempfile_m(filename_template, 0600);
 }
 
 /*
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 36/37] trailer: rename 'template' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (34 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 35/37] tempfile: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-29 22:37 ` [PATCH 37/37] replace: rename 'new' variables Brandon Williams
                   ` (3 subsequent siblings)
  39 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 trailer.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/trailer.c b/trailer.c
index 5a4a2ecf9..c508c9b75 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1000,7 +1000,7 @@ static struct tempfile *trailers_tempfile;
 static FILE *create_in_place_tempfile(const char *file)
 {
 	struct stat st;
-	struct strbuf template = STRBUF_INIT;
+	struct strbuf filename_template = STRBUF_INIT;
 	const char *tail;
 	FILE *outfile;
 
@@ -1014,11 +1014,11 @@ static FILE *create_in_place_tempfile(const char *file)
 	/* Create temporary file in the same directory as the original */
 	tail = strrchr(file, '/');
 	if (tail != NULL)
-		strbuf_add(&template, file, tail - file + 1);
-	strbuf_addstr(&template, "git-interpret-trailers-XXXXXX");
+		strbuf_add(&filename_template, file, tail - file + 1);
+	strbuf_addstr(&filename_template, "git-interpret-trailers-XXXXXX");
 
-	trailers_tempfile = xmks_tempfile_m(template.buf, st.st_mode);
-	strbuf_release(&template);
+	trailers_tempfile = xmks_tempfile_m(filename_template.buf, st.st_mode);
+	strbuf_release(&filename_template);
 	outfile = fdopen_tempfile(trailers_tempfile, "w");
 	if (!outfile)
 		die_errno(_("could not open temporary file"));
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH 37/37] replace: rename 'new' variables
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (35 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 36/37] trailer: " Brandon Williams
@ 2018-01-29 22:37 ` Brandon Williams
  2018-01-30 22:58   ` Stefan Beller
  2018-01-30  0:13 ` [PATCH 00/37] removal of some c++ keywords Duy Nguyen
                   ` (2 subsequent siblings)
  39 siblings, 1 reply; 89+ messages in thread
From: Brandon Williams @ 2018-01-29 22:37 UTC (permalink / raw)
  To: git; +Cc: j6t, avarab, Brandon Williams

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>
---
 builtin/replace.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/builtin/replace.c b/builtin/replace.c
index 42cf4f62a..e48835b54 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -284,7 +284,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
 {
 	char *tmpfile = git_pathdup("REPLACE_EDITOBJ");
 	enum object_type type;
-	struct object_id old, new, prev;
+	struct object_id old, new_oid, prev;
 	struct strbuf ref = STRBUF_INIT;
 
 	if (get_oid(object_ref, &old) < 0)
@@ -300,14 +300,14 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
 	export_object(&old, type, raw, tmpfile);
 	if (launch_editor(tmpfile, NULL, NULL) < 0)
 		die("editing object file failed");
-	import_object(&new, type, raw, tmpfile);
+	import_object(&new_oid, type, raw, tmpfile);
 
 	free(tmpfile);
 
-	if (!oidcmp(&old, &new))
+	if (!oidcmp(&old, &new_oid))
 		return error("new object is the same as the old one: '%s'", oid_to_hex(&old));
 
-	return replace_object_oid(object_ref, &old, "replacement", &new, force);
+	return replace_object_oid(object_ref, &old, "replacement", &new_oid, force);
 }
 
 static void replace_parents(struct strbuf *buf, int argc, const char **argv)
@@ -386,7 +386,7 @@ static void check_mergetags(struct commit *commit, int argc, const char **argv)
 
 static int create_graft(int argc, const char **argv, int force)
 {
-	struct object_id old, new;
+	struct object_id old, new_oid;
 	const char *old_ref = argv[0];
 	struct commit *commit;
 	struct strbuf buf = STRBUF_INIT;
@@ -410,15 +410,15 @@ static int create_graft(int argc, const char **argv, int force)
 
 	check_mergetags(commit, argc, argv);
 
-	if (write_sha1_file(buf.buf, buf.len, commit_type, new.hash))
+	if (write_sha1_file(buf.buf, buf.len, commit_type, new_oid.hash))
 		die(_("could not write replacement commit for: '%s'"), old_ref);
 
 	strbuf_release(&buf);
 
-	if (!oidcmp(&old, &new))
+	if (!oidcmp(&old, &new_oid))
 		return error("new commit is the same as the old one: '%s'", oid_to_hex(&old));
 
-	return replace_object_oid(old_ref, &old, "replacement", &new, force);
+	return replace_object_oid(old_ref, &old, "replacement", &new_oid, force);
 }
 
 int cmd_replace(int argc, const char **argv, const char *prefix)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* Re: [PATCH 00/37] removal of some c++ keywords
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (36 preceding siblings ...)
  2018-01-29 22:37 ` [PATCH 37/37] replace: rename 'new' variables Brandon Williams
@ 2018-01-30  0:13 ` Duy Nguyen
  2018-01-30 22:36   ` Junio C Hamano
  2018-01-30 20:54 ` Johannes Sixt
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
  39 siblings, 1 reply; 89+ messages in thread
From: Duy Nguyen @ 2018-01-30  0:13 UTC (permalink / raw)
  To: Brandon Williams
  Cc: Git Mailing List, Johannes Sixt,
	Ævar Arnfjörð Bjarmason

On Tue, Jan 30, 2018 at 5:36 AM, Brandon Williams <bmwill@google.com> wrote:
> A while back there was some discussion of getting our codebase into a state
> where we could use a c++ compiler if we wanted to (for various reason like
> leveraging c++ only analysis tools, etc.).  Johannes Sixt had a very large

I would be more convinced if I knew exactly what leverage we could
have here (e.g. what tool, how many problems it caught...).

> patch that achieved this but it wasn't in a state where it could be upstreamed.
> I took that idea and did some removals of c++ keywords (new, template, try,
> this, etc) but broke it up into several (well maybe more than several) patches.
> I don't believe I've captured all of them in this series but this is at least
> moving a step closer to being able to compile using a c++ compiler.

Is it simpler (though hacky) to just  do

#ifdef __cplusplus
#define new not_new
#define try really_try
...

somewhere in git-compat-util.h?

Do we use any C features that are incompatible with C++? (or do we not
need to care?)

> I don't know if this is something the community still wants to move towards,
> but if this is something people are still interested in, and this series is
> wanted, then we can keep doing these sort of conversions in chunks slowly.

You're going to need to setup C++ build job on Travis or something to
catch new C++ keywords from entering the code base as well if you move
this to the end.
-- 
Duy

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 00/37] removal of some c++ keywords
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (37 preceding siblings ...)
  2018-01-30  0:13 ` [PATCH 00/37] removal of some c++ keywords Duy Nguyen
@ 2018-01-30 20:54 ` Johannes Sixt
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
  39 siblings, 0 replies; 89+ messages in thread
From: Johannes Sixt @ 2018-01-30 20:54 UTC (permalink / raw)
  To: Brandon Williams; +Cc: git, avarab

Am 29.01.2018 um 23:36 schrieb Brandon Williams:
> A while back there was some discussion of getting our codebase into a state
> where we could use a c++ compiler if we wanted to (for various reason like
> leveraging c++ only analysis tools, etc.).  Johannes Sixt had a very large
> patch that achieved this but it wasn't in a state where it could be upstreamed.
> I took that idea and did some removals of c++ keywords (new, template, try,
> this, etc) but broke it up into several (well maybe more than several) patches.
> I don't believe I've captured all of them in this series but this is at least
> moving a step closer to being able to compile using a c++ compiler.

Cool! The patches all look reasonable. Some keywords remain: 'delete', 
'private', 'thread_local', 'not', 'xor', 'explicit', 'export'.

> I don't know if this is something the community still wants to move towards,
> but if this is something people are still interested in, and this series is
> wanted, then we can keep doing these sort of conversions in chunks slowly.

I've rebased my patches on top of this series. They are available from

   https://github.com/j6t/git.git c-plus-plus

-- Hannes

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 00/37] removal of some c++ keywords
  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
  0 siblings, 1 reply; 89+ messages in thread
From: Junio C Hamano @ 2018-01-30 22:36 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Brandon Williams, Git Mailing List, Johannes Sixt,
	Ævar Arnfjörð Bjarmason

Duy Nguyen <pclouds@gmail.com> writes:

> Is it simpler (though hacky) to just  do
>
> #ifdef __cplusplus
> #define new not_new
> #define try really_try
> ...
>
> somewhere in git-compat-util.h?

Very tempting, especially given that your approach automatically
would cover topics in flight without any merge conflict ;-)

I agree that it is hacky and somewhat ugly, but the hackiness
somehow does not bother me too much in this case; perhaps because
attempting to use a C++ compiler may already be hacky in the first
place?

It probably depends on the reason why we are doing this topic.  If a
report about our source code coming from the C++ oriented tool cite
the symbol names seen by machines, then the "hacky" approach will
give us "not_new" where Brandon's patch may give us "new_oid", or
whatever symbol that is more appropriate for the context it appears
than such an automated cute name.

> Do we use any C features that are incompatible with C++? (or do we not
> need to care?)

Good question.

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 37/37] replace: rename 'new' variables
  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
  0 siblings, 1 reply; 89+ messages in thread
From: Stefan Beller @ 2018-01-30 22:58 UTC (permalink / raw)
  To: Brandon Williams
  Cc: git, Johannes Sixt, Ævar Arnfjörð Bjarmason

On Mon, Jan 29, 2018 at 2:37 PM, Brandon Williams <bmwill@google.com> wrote:
> 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>
> ---
>  builtin/replace.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/replace.c b/builtin/replace.c
> index 42cf4f62a..e48835b54 100644
> --- a/builtin/replace.c
> +++ b/builtin/replace.c
> @@ -284,7 +284,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
>  {
>         char *tmpfile = git_pathdup("REPLACE_EDITOBJ");
>         enum object_type type;
> -       struct object_id old, new, prev;
> +       struct object_id old, new_oid, prev;

new is a keyword that often comes with a counterpart, here `old`.
So while at it, also rename old to old_oid ?
Do we care about the symmetry enough to warrant additional churn for this?

Stefan

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 00/37] removal of some c++ keywords
  2018-01-30 22:36   ` Junio C Hamano
@ 2018-01-30 23:01     ` Stefan Beller
  2018-01-31  0:48       ` Duy Nguyen
  0 siblings, 1 reply; 89+ messages in thread
From: Stefan Beller @ 2018-01-30 23:01 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Duy Nguyen, Brandon Williams, Git Mailing List, Johannes Sixt,
	Ævar Arnfjörð Bjarmason

On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> Is it simpler (though hacky) to just  do
>>
>> #ifdef __cplusplus
>> #define new not_new
>> #define try really_try
>> ...
>>
>> somewhere in git-compat-util.h?
>
> Very tempting, especially given that your approach automatically
> would cover topics in flight without any merge conflict ;-)
>
> I agree that it is hacky and somewhat ugly, but the hackiness
> somehow does not bother me too much in this case; perhaps because
> attempting to use a C++ compiler may already be hacky in the first
> place?
>
> It probably depends on the reason why we are doing this topic.  If a
> report about our source code coming from the C++ oriented tool cite
> the symbol names seen by machines, then the "hacky" approach will
> give us "not_new" where Brandon's patch may give us "new_oid", or
> whatever symbol that is more appropriate for the context it appears
> than such an automated cute name.
>
>> Do we use any C features that are incompatible with C++? (or do we not
>> need to care?)
>
> Good question.

implicit casts from void?
e.g. xmalloc returns a void pointer, not the type requested.
https://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 37/37] replace: rename 'new' variables
  2018-01-30 22:58   ` Stefan Beller
@ 2018-01-30 23:21     ` Junio C Hamano
  0 siblings, 0 replies; 89+ messages in thread
From: Junio C Hamano @ 2018-01-30 23:21 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Brandon Williams, git, Johannes Sixt,
	Ævar Arnfjörð Bjarmason

Stefan Beller <sbeller@google.com> writes:

> On Mon, Jan 29, 2018 at 2:37 PM, Brandon Williams <bmwill@google.com> wrote:
>> 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>
>> ---
>>  builtin/replace.c | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/builtin/replace.c b/builtin/replace.c
>> index 42cf4f62a..e48835b54 100644
>> --- a/builtin/replace.c
>> +++ b/builtin/replace.c
>> @@ -284,7 +284,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
>>  {
>>         char *tmpfile = git_pathdup("REPLACE_EDITOBJ");
>>         enum object_type type;
>> -       struct object_id old, new, prev;
>> +       struct object_id old, new_oid, prev;
>
> new is a keyword that often comes with a counterpart, here `old`.
> So while at it, also rename old to old_oid ?
> Do we care about the symmetry enough to warrant additional churn for this?

Absolutely.  That is one of the reasons why the "hacky" approach is
so attractive---it does not force those who are doing conversion to
think.  With this approach, "new" in this context gets replaced with
new_oid (because this is about oid; in another codepath, "new" and
"old" might have been referring to a file and the new names for them
would have been "new_file" vs "old_file") after some thought, and
the same thought process should realize "old" must become "old_oid".

Very good point.

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 00/37] removal of some c++ keywords
  2018-01-30 23:01     ` Stefan Beller
@ 2018-01-31  0:48       ` Duy Nguyen
  2018-01-31  0:57         ` Stefan Beller
  0 siblings, 1 reply; 89+ messages in thread
From: Duy Nguyen @ 2018-01-31  0:48 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Junio C Hamano, Brandon Williams, Git Mailing List, Johannes Sixt,
	Ævar Arnfjörð Bjarmason

On Wed, Jan 31, 2018 at 6:01 AM, Stefan Beller <sbeller@google.com> wrote:
> On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Duy Nguyen <pclouds@gmail.com> writes:
>>
>>> Is it simpler (though hacky) to just  do
>>>
>>> #ifdef __cplusplus
>>> #define new not_new
>>> #define try really_try
>>> ...
>>>
>>> somewhere in git-compat-util.h?
>>
>> Very tempting, especially given that your approach automatically
>> would cover topics in flight without any merge conflict ;-)
>>
>> I agree that it is hacky and somewhat ugly, but the hackiness
>> somehow does not bother me too much in this case; perhaps because
>> attempting to use a C++ compiler may already be hacky in the first
>> place?
>>
>> It probably depends on the reason why we are doing this topic.  If a
>> report about our source code coming from the C++ oriented tool cite
>> the symbol names seen by machines, then the "hacky" approach will
>> give us "not_new" where Brandon's patch may give us "new_oid", or
>> whatever symbol that is more appropriate for the context it appears
>> than such an automated cute name.

Well. the world after post processing is always ugly. But we could try
"#define new new__" to get the not so ugly names. new_oid is
definitely better regardless of c/c++ though so I could see that as a
good cleanup.

>>> Do we use any C features that are incompatible with C++? (or do we not
>>> need to care?)
>>
>> Good question.
>
> implicit casts from void?
> e.g. xmalloc returns a void pointer, not the type requested.
> https://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc

That causes lots of warnings but not errors (I bit the bullet and
tried to compile git with g++). The next set of changes would be to
reorganize nested enum/struct declarations. Even if nested, C
considers these flat while C++ sees them in namespaces. There's some
warnings about confusion with the new cool feature string literals,
but that's easy to fix.

There's also C99 designator in builtin/clean.c (I thought we avoided
C99, I can start using this specific feature more now :D)

I was stuck at the thread_local thing in index-pack.c and gave up. So
I don't know what else we would need to change.
-- 
Duy

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 00/37] removal of some c++ keywords
  2018-01-31  0:48       ` Duy Nguyen
@ 2018-01-31  0:57         ` Stefan Beller
  2018-01-31  1:05           ` Duy Nguyen
  0 siblings, 1 reply; 89+ messages in thread
From: Stefan Beller @ 2018-01-31  0:57 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Junio C Hamano, Brandon Williams, Git Mailing List, Johannes Sixt,
	Ævar Arnfjörð Bjarmason

On Tue, Jan 30, 2018 at 4:48 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Wed, Jan 31, 2018 at 6:01 AM, Stefan Beller <sbeller@google.com> wrote:
>> On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Duy Nguyen <pclouds@gmail.com> writes:
>>>
>>>> Is it simpler (though hacky) to just  do
>>>>
>>>> #ifdef __cplusplus
>>>> #define new not_new
>>>> #define try really_try
>>>> ...
>>>>
>>>> somewhere in git-compat-util.h?
>>>
>>> Very tempting, especially given that your approach automatically
>>> would cover topics in flight without any merge conflict ;-)
>>>
>>> I agree that it is hacky and somewhat ugly, but the hackiness
>>> somehow does not bother me too much in this case; perhaps because
>>> attempting to use a C++ compiler may already be hacky in the first
>>> place?
>>>
>>> It probably depends on the reason why we are doing this topic.  If a
>>> report about our source code coming from the C++ oriented tool cite
>>> the symbol names seen by machines, then the "hacky" approach will
>>> give us "not_new" where Brandon's patch may give us "new_oid", or
>>> whatever symbol that is more appropriate for the context it appears
>>> than such an automated cute name.
>
> Well. the world after post processing is always ugly. But we could try
> "#define new new__" to get the not so ugly names. new_oid is
> definitely better regardless of c/c++ though so I could see that as a
> good cleanup.
>
>>>> Do we use any C features that are incompatible with C++? (or do we not
>>>> need to care?)
>>>
>>> Good question.
>>
>> implicit casts from void?
>> e.g. xmalloc returns a void pointer, not the type requested.
>> https://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc
>
> That causes lots of warnings but not errors (I bit the bullet and
> tried to compile git with g++).

And for g++ there is a flag to disable this specific set of warnings.
I think the value of using C++ analysis tools is in the LLVM/clang
world, not GNU.

> The next set of changes would be to
> reorganize nested enum/struct declarations. Even if nested, C
> considers these flat while C++ sees them in namespaces. There's some
> warnings about confusion with the new cool feature string literals,
> but that's easy to fix.
>
> There's also C99 designator in builtin/clean.c (I thought we avoided
> C99, I can start using this specific feature more now :D)

That was a test balloon? See 512f41cfac
(clean.c: use designated initializer, 2017-07-14)

One of the big advantages would be stricter type checking, such as
signed/unsigned confusion, that we occasionally have.
e.g. 61d36330b4 (prefer "!=" when checking read_in_full()
result, 2017-09-27) or what is referenced from there 561598cfcf
(read_pack_header: handle signed/unsigned comparison in read result,
2017-09-13).

The bugs resulting in these patches could have been caught more easily
with C++ checking IMHO.

> I was stuck at the thread_local thing in index-pack.c and gave up. So
> I don't know what else we would need to change.

Thanks for experimenting!
Stefan

> --
> Duy

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH 00/37] removal of some c++ keywords
  2018-01-31  0:57         ` Stefan Beller
@ 2018-01-31  1:05           ` Duy Nguyen
  0 siblings, 0 replies; 89+ messages in thread
From: Duy Nguyen @ 2018-01-31  1:05 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Junio C Hamano, Brandon Williams, Git Mailing List, Johannes Sixt,
	Ævar Arnfjörð Bjarmason

On Wed, Jan 31, 2018 at 7:57 AM, Stefan Beller <sbeller@google.com> wrote:
>> There's also C99 designator in builtin/clean.c (I thought we avoided
>> C99, I can start using this specific feature more now :D)
>
> That was a test balloon? See 512f41cfac
> (clean.c: use designated initializer, 2017-07-14)

Aww.. I thought it was in there since forever and it should be safe to
use now...

> One of the big advantages would be stricter type checking, such as
> signed/unsigned confusion, that we occasionally have.
> e.g. 61d36330b4 (prefer "!=" when checking read_in_full()
> result, 2017-09-27) or what is referenced from there 561598cfcf
> (read_pack_header: handle signed/unsigned comparison in read result,
> 2017-09-13).

We can do that even with C (at least with gcc and I guess clang as
well). The problem is it looks so bad right now that I have to turn it
off with -Wno-sign-compare

> The bugs resulting in these patches could have been caught more easily
> with C++ checking IMHO.
-- 
Duy

^ permalink raw reply	[flat|nested] 89+ messages in thread

* [PATCH v2 00/37] removal of some c++ keywords
  2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
                   ` (38 preceding siblings ...)
  2018-01-30 20:54 ` Johannes Sixt
@ 2018-02-14 18:59 ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 01/37] object_info: change member name from 'typename' to 'type_name' Brandon Williams
                     ` (37 more replies)
  39 siblings, 38 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

One person was interested enough for me to go back through and also
rename all the paired 'old' variables to match the new names for the
variables which were named 'new'.

Brandon Williams (37):
  object_info: change member name from 'typename' to 'type_name'
  object: rename function 'typename' to 'type_name'
  blame: rename 'this' variables
  pack-objects: rename 'this' variables
  rev-parse: rename 'this' variable
  diff: rename 'this' variables
  apply: rename 'try' variables
  apply: rename 'new' variables
  checkout: rename 'new' variables
  help: rename 'new' variables
  pack-redundant: rename 'new' variables
  reflog: rename 'new' variables
  remote: rename 'new' variables
  combine-diff: rename 'new' variables
  commit: rename 'new' variables
  diff-lib: rename 'new' variable
  diff: rename 'new' variables
  diffcore-delta: rename 'new' variables
  entry: rename 'new' variables
  http: rename 'new' variables
  imap-send: rename 'new' variables
  line-log: rename 'new' variables
  read-cache: rename 'new' variables
  ref-filter: rename 'new' variables
  remote: rename 'new' variables
  split-index: rename 'new' variables
  submodule: rename 'new' variables
  trailer: rename 'new' variables
  unpack-trees: rename 'new' variables
  init-db: rename 'template' variables
  environment: rename 'template' variables
  diff: rename 'template' variables
  environment: rename 'namespace' variables
  wrapper: rename 'template' variables
  tempfile: rename 'template' variables
  trailer: rename 'template' variables
  replace: rename 'new' variables

 apply.c                                | 122 +++++++--------
 blame.c                                |  33 +++--
 builtin/cat-file.c                     |   4 +-
 builtin/checkout.c                     | 196 ++++++++++++-------------
 builtin/diff-tree.c                    |   2 +-
 builtin/fast-export.c                  |   8 +-
 builtin/fsck.c                         |   4 +-
 builtin/grep.c                         |   2 +-
 builtin/help.c                         |  10 +-
 builtin/index-pack.c                   |  12 +-
 builtin/init-db.c                      |  30 ++--
 builtin/merge.c                        |   2 +-
 builtin/mktree.c                       |   4 +-
 builtin/pack-objects.c                 |   8 +-
 builtin/pack-redundant.c               |  54 +++----
 builtin/prune.c                        |   2 +-
 builtin/reflog.c                       |   8 +-
 builtin/remote.c                       |  66 ++++-----
 builtin/replace.c                      |  46 +++---
 builtin/rev-parse.c                    |  34 ++---
 builtin/tag.c                          |   2 +-
 builtin/unpack-objects.c               |  10 +-
 builtin/verify-commit.c                |   2 +-
 bulk-checkin.c                         |   2 +-
 cache.h                                |   4 +-
 combine-diff.c                         |  12 +-
 commit.c                               |  20 +--
 contrib/examples/builtin-fetch--tool.c |   2 +-
 diff-lib.c                             |  38 ++---
 diff.c                                 |  62 ++++----
 diffcore-delta.c                       |  16 +-
 entry.c                                |  40 ++---
 environment.c                          |  24 +--
 fast-import.c                          |  16 +-
 fsck.c                                 |   2 +-
 git-compat-util.h                      |   4 +-
 http-push.c                            |   2 +-
 http.c                                 |  10 +-
 imap-send.c                            |  14 +-
 line-log.c                             |  56 +++----
 log-tree.c                             |   2 +-
 object.c                               |   6 +-
 object.h                               |   2 +-
 pack-check.c                           |   2 +-
 packfile.c                             |   8 +-
 reachable.c                            |   2 +-
 read-cache.c                           |  40 ++---
 ref-filter.c                           |  20 +--
 remote.c                               |  20 +--
 sequencer.c                            |   2 +-
 sha1_file.c                            |  28 ++--
 sha1_name.c                            |   6 +-
 split-index.c                          |  16 +-
 split-index.h                          |   2 +-
 submodule.c                            |  32 ++--
 submodule.h                            |   2 +-
 tag.c                                  |   2 +-
 tempfile.c                             |  12 +-
 tempfile.h                             |  34 ++---
 trailer.c                              |  44 +++---
 unpack-trees.c                         |   6 +-
 walker.c                               |   4 +-
 wrapper.c                              |  40 ++---
 63 files changed, 659 insertions(+), 658 deletions(-)

-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply	[flat|nested] 89+ messages in thread

* [PATCH v2 01/37] object_info: change member name from 'typename' to 'type_name'
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 02/37] object: rename function " Brandon Williams
                     ` (36 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/cat-file.c |  2 +-
 cache.h            |  2 +-
 packfile.c         |  6 +++---
 sha1_file.c        | 10 +++++-----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index f5fa4fd75..d06c66c77 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -76,7 +76,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
 	buf = NULL;
 	switch (opt) {
 	case 't':
-		oi.typename = &sb;
+		oi.type_name = &sb;
 		if (sha1_object_info_extended(oid.hash, &oi, flags) < 0)
 			die("git cat-file: could not get object info");
 		if (sb.len) {
diff --git a/cache.h b/cache.h
index d8b975a57..69b5a3bf8 100644
--- a/cache.h
+++ b/cache.h
@@ -1744,7 +1744,7 @@ struct object_info {
 	unsigned long *sizep;
 	off_t *disk_sizep;
 	unsigned char *delta_base_sha1;
-	struct strbuf *typename;
+	struct strbuf *type_name;
 	void **contentp;
 
 	/* Response */
diff --git a/packfile.c b/packfile.c
index 4a5fe7ab1..6657a0a49 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1350,16 +1350,16 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
 		*oi->disk_sizep = revidx[1].offset - obj_offset;
 	}
 
-	if (oi->typep || oi->typename) {
+	if (oi->typep || oi->type_name) {
 		enum object_type ptot;
 		ptot = packed_to_object_type(p, obj_offset, type, &w_curs,
 					     curpos);
 		if (oi->typep)
 			*oi->typep = ptot;
-		if (oi->typename) {
+		if (oi->type_name) {
 			const char *tn = typename(ptot);
 			if (tn)
-				strbuf_addstr(oi->typename, tn);
+				strbuf_addstr(oi->type_name, tn);
 		}
 		if (ptot < 0) {
 			type = OBJ_BAD;
diff --git a/sha1_file.c b/sha1_file.c
index 3da70ac65..2c03458ea 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1087,8 +1087,8 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,
 	}
 
 	type = type_from_string_gently(type_buf, type_len, 1);
-	if (oi->typename)
-		strbuf_add(oi->typename, type_buf, type_len);
+	if (oi->type_name)
+		strbuf_add(oi->type_name, type_buf, type_len);
 	/*
 	 * Set type to 0 if its an unknown object and
 	 * we're obtaining the type using '--allow-unknown-type'
@@ -1158,7 +1158,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,
 	 * return value implicitly indicates whether the
 	 * object even exists.
 	 */
-	if (!oi->typep && !oi->typename && !oi->sizep && !oi->contentp) {
+	if (!oi->typep && !oi->type_name && !oi->sizep && !oi->contentp) {
 		const char *path;
 		struct stat st;
 		if (stat_sha1_file(sha1, &st, &path) < 0)
@@ -1239,8 +1239,8 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
 				*(oi->disk_sizep) = 0;
 			if (oi->delta_base_sha1)
 				hashclr(oi->delta_base_sha1);
-			if (oi->typename)
-				strbuf_addstr(oi->typename, typename(co->type));
+			if (oi->type_name)
+				strbuf_addstr(oi->type_name, typename(co->type));
 			if (oi->contentp)
 				*oi->contentp = xmemdupz(co->buf, co->size);
 			oi->whence = OI_CACHED;
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 02/37] object: rename function 'typename' to 'type_name'
  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   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 03/37] blame: rename 'this' variables Brandon Williams
                     ` (35 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/cat-file.c                     |  2 +-
 builtin/diff-tree.c                    |  2 +-
 builtin/fast-export.c                  |  8 ++++----
 builtin/fsck.c                         |  4 ++--
 builtin/grep.c                         |  2 +-
 builtin/index-pack.c                   | 12 ++++++------
 builtin/merge.c                        |  2 +-
 builtin/mktree.c                       |  4 ++--
 builtin/prune.c                        |  2 +-
 builtin/replace.c                      | 12 ++++++------
 builtin/tag.c                          |  2 +-
 builtin/unpack-objects.c               | 10 +++++-----
 builtin/verify-commit.c                |  2 +-
 bulk-checkin.c                         |  2 +-
 commit.c                               |  2 +-
 contrib/examples/builtin-fetch--tool.c |  2 +-
 fast-import.c                          | 16 ++++++++--------
 fsck.c                                 |  2 +-
 http-push.c                            |  2 +-
 log-tree.c                             |  2 +-
 object.c                               |  6 +++---
 object.h                               |  2 +-
 pack-check.c                           |  2 +-
 packfile.c                             |  2 +-
 reachable.c                            |  2 +-
 ref-filter.c                           |  4 ++--
 sequencer.c                            |  2 +-
 sha1_file.c                            | 20 ++++++++++----------
 sha1_name.c                            |  6 +++---
 submodule.c                            |  2 +-
 tag.c                                  |  2 +-
 walker.c                               |  4 ++--
 32 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index d06c66c77..c6b3b1bfb 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -229,7 +229,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
 		if (data->mark_query)
 			data->info.typep = &data->type;
 		else
-			strbuf_addstr(sb, typename(data->type));
+			strbuf_addstr(sb, type_name(data->type));
 	} else if (is_atom("objectsize", atom, len)) {
 		if (data->mark_query)
 			data->info.sizep = &data->size;
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index b775a7564..473615117 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -76,7 +76,7 @@ static int diff_tree_stdin(char *line)
 	if (obj->type == OBJ_TREE)
 		return stdin_diff_trees((struct tree *)obj, p);
 	error("Object %s is a %s, not a commit or tree",
-	      oid_to_hex(&oid), typename(obj->type));
+	      oid_to_hex(&oid), type_name(obj->type));
 	return -1;
 }
 
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 796d0cd66..27b2cc138 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid)
 		buf = read_sha1_file(oid->hash, &type, &size);
 		if (!buf)
 			die ("Could not read blob %s", oid_to_hex(oid));
-		if (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)
+		if (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0)
 			die("sha1 mismatch in blob %s", oid_to_hex(oid));
 		object = parse_object_buffer(oid, type, size, buf, &eaten);
 	}
@@ -757,7 +757,7 @@ static void handle_tag(const char *name, struct tag *tag)
 			if (tagged->type != OBJ_COMMIT) {
 				die ("Tag %s tags unexported %s!",
 				     oid_to_hex(&tag->object.oid),
-				     typename(tagged->type));
+				     type_name(tagged->type));
 			}
 			p = (struct commit *)tagged;
 			for (;;) {
@@ -839,7 +839,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
 		if (!commit) {
 			warning("%s: Unexpected object of type %s, skipping.",
 				e->name,
-				typename(e->item->type));
+				type_name(e->item->type));
 			continue;
 		}
 
@@ -851,7 +851,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
 			continue;
 		default: /* OBJ_TAG (nested tags) is already handled */
 			warning("Tag points to object of unexpected type %s, skipping.",
-				typename(commit->object.type));
+				type_name(commit->object.type));
 			continue;
 		}
 
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 04846d46f..246237e81 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -70,7 +70,7 @@ static const char *printable_type(struct object *obj)
 			object_as_type(obj, type, 0);
 	}
 
-	ret = typename(obj->type);
+	ret = type_name(obj->type);
 	if (!ret)
 		ret = "unknown";
 
@@ -137,7 +137,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt
 		printf("broken link from %7s %s\n",
 			   printable_type(parent), describe_object(parent));
 		printf("broken link from %7s %s\n",
-			   (type == OBJ_ANY ? "unknown" : typename(type)), "unknown");
+			   (type == OBJ_ANY ? "unknown" : type_name(type)), "unknown");
 		errors_found |= ERROR_REACHABLE;
 		return 1;
 	}
diff --git a/builtin/grep.c b/builtin/grep.c
index 3ca4ac80d..eb1207095 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -627,7 +627,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
 		free(data);
 		return hit;
 	}
-	die(_("unable to grep from object of type %s"), typename(obj->type));
+	die(_("unable to grep from object of type %s"), type_name(obj->type));
 }
 
 static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 4c51aec81..8b87090e2 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -228,7 +228,7 @@ static unsigned check_object(struct object *obj)
 		if (type != obj->type)
 			die(_("object %s: expected type %s, found %s"),
 			    oid_to_hex(&obj->oid),
-			    typename(obj->type), typename(type));
+			    type_name(obj->type), type_name(type));
 		obj->flags |= FLAG_CHECKED;
 		return 1;
 	}
@@ -448,7 +448,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
 	int hdrlen;
 
 	if (!is_delta_type(type)) {
-		hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
+		hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), size) + 1;
 		git_SHA1_Init(&c);
 		git_SHA1_Update(&c, hdr, hdrlen);
 	} else
@@ -849,7 +849,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
 			obj = parse_object_buffer(oid, type, size, buf,
 						  &eaten);
 			if (!obj)
-				die(_("invalid %s"), typename(type));
+				die(_("invalid %s"), type_name(type));
 			if (do_fsck_object &&
 			    fsck_object(obj, buf, size, &fsck_options))
 				die(_("Error in object"));
@@ -959,7 +959,7 @@ static void resolve_delta(struct object_entry *delta_obj,
 	if (!result->data)
 		bad_object(delta_obj->idx.offset, _("failed to apply delta"));
 	hash_sha1_file(result->data, result->size,
-		       typename(delta_obj->real_type),
+		       type_name(delta_obj->real_type),
 		       delta_obj->idx.oid.hash);
 	sha1_object(result->data, NULL, result->size, delta_obj->real_type,
 		    &delta_obj->idx.oid);
@@ -1379,7 +1379,7 @@ static void fix_unresolved_deltas(struct sha1file *f)
 			continue;
 
 		if (check_sha1_signature(d->sha1, base_obj->data,
-				base_obj->size, typename(type)))
+				base_obj->size, type_name(type)))
 			die(_("local object %s is corrupt"), sha1_to_hex(d->sha1));
 		base_obj->obj = append_obj_to_pack(f, d->sha1,
 					base_obj->data, base_obj->size, type);
@@ -1588,7 +1588,7 @@ static void show_pack_info(int stat_only)
 			continue;
 		printf("%s %-6s %lu %lu %"PRIuMAX,
 		       oid_to_hex(&obj->idx.oid),
-		       typename(obj->real_type), obj->size,
+		       type_name(obj->real_type), obj->size,
 		       (unsigned long)(obj[1].idx.offset - obj->idx.offset),
 		       (uintmax_t)obj->idx.offset);
 		if (is_delta_type(obj->type)) {
diff --git a/builtin/merge.c b/builtin/merge.c
index 30264cfd7..9dec14096 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -520,7 +520,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
 		if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
 			strbuf_addf(msg, "%s\t\t%s '%s'\n",
 				    oid_to_hex(&desc->obj->oid),
-				    typename(desc->obj->type),
+				    type_name(desc->obj->type),
 				    remote);
 			goto cleanup;
 		}
diff --git a/builtin/mktree.c b/builtin/mktree.c
index da0fd8cd7..b7b1cb51f 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -112,7 +112,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
 	mode_type = object_type(mode);
 	if (mode_type != type_from_string(ptr)) {
 		die("entry '%s' object type (%s) doesn't match mode type (%s)",
-			path, ptr, typename(mode_type));
+			path, ptr, type_name(mode_type));
 	}
 
 	/* Check the type of object identified by sha1 */
@@ -131,7 +131,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
 			 * because the new tree entry will never be correct.
 			 */
 			die("entry '%s' object %s is a %s but specified type was (%s)",
-				path, sha1_to_hex(sha1), typename(obj_type), typename(mode_type));
+				path, sha1_to_hex(sha1), type_name(obj_type), type_name(mode_type));
 		}
 	}
 
diff --git a/builtin/prune.c b/builtin/prune.c
index d2fdae680..c175f154e 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -52,7 +52,7 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
 	if (show_only || verbose) {
 		enum object_type type = sha1_object_info(oid->hash, NULL);
 		printf("%s %s\n", oid_to_hex(oid),
-		       (type > 0) ? typename(type) : "unknown");
+		       (type > 0) ? type_name(type) : "unknown");
 	}
 	if (!show_only)
 		unlink_or_warn(fullpath);
diff --git a/builtin/replace.c b/builtin/replace.c
index 10078ae37..42cf4f62a 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -56,8 +56,8 @@ static int show_reference(const char *refname, const struct object_id *oid,
 			obj_type = sha1_object_info(object.hash, NULL);
 			repl_type = sha1_object_info(oid->hash, NULL);
 
-			printf("%s (%s) -> %s (%s)\n", refname, typename(obj_type),
-			       oid_to_hex(oid), typename(repl_type));
+			printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
+			       oid_to_hex(oid), type_name(repl_type));
 		}
 	}
 
@@ -168,8 +168,8 @@ static int replace_object_oid(const char *object_ref,
 		die("Objects must be of the same type.\n"
 		    "'%s' points to a replaced object of type '%s'\n"
 		    "while '%s' points to a replacement object of type '%s'.",
-		    object_ref, typename(obj_type),
-		    replace_ref, typename(repl_type));
+		    object_ref, type_name(obj_type),
+		    replace_ref, type_name(repl_type));
 
 	check_ref_valid(object, &prev, &ref, force);
 
@@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,
 	argv_array_push(&cmd.args, "--no-replace-objects");
 	argv_array_push(&cmd.args, "cat-file");
 	if (raw)
-		argv_array_push(&cmd.args, typename(type));
+		argv_array_push(&cmd.args, type_name(type));
 	else
 		argv_array_push(&cmd.args, "-p");
 	argv_array_push(&cmd.args, oid_to_hex(oid));
@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
 	struct tag *tag;
 	int i;
 
-	hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
+	hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);
 	tag = lookup_tag(&tag_oid);
 	if (!tag)
 		die(_("bad mergetag in commit '%s'"), ref);
diff --git a/builtin/tag.c b/builtin/tag.c
index a7e6a5b0f..7e0881fba 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -220,7 +220,7 @@ static void create_tag(const struct object_id *object, const char *tag,
 		    "tag %s\n"
 		    "tagger %s\n\n",
 		    oid_to_hex(object),
-		    typename(type),
+		    type_name(type),
 		    tag,
 		    git_committer_info(IDENT_STRICT));
 
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 62ea264c4..e93079070 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -172,7 +172,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
 {
 	struct object_id oid;
 
-	if (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0)
+	if (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)
 		die("failed to write object %s", oid_to_hex(&obj->oid));
 	obj->flags |= FLAG_WRITTEN;
 }
@@ -237,14 +237,14 @@ static void write_object(unsigned nr, enum object_type type,
 			 void *buf, unsigned long size)
 {
 	if (!strict) {
-		if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
+		if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
 			die("failed to write object");
 		added_object(nr, type, buf, size);
 		free(buf);
 		obj_list[nr].obj = NULL;
 	} else if (type == OBJ_BLOB) {
 		struct blob *blob;
-		if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
+		if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
 			die("failed to write object");
 		added_object(nr, type, buf, size);
 		free(buf);
@@ -258,12 +258,12 @@ static void write_object(unsigned nr, enum object_type type,
 	} else {
 		struct object *obj;
 		int eaten;
-		hash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);
+		hash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);
 		added_object(nr, type, buf, size);
 		obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
 					  &eaten);
 		if (!obj)
-			die("invalid %s", typename(type));
+			die("invalid %s", type_name(type));
 		add_object_buffer(obj, buf, size);
 		obj->flags |= FLAG_OPEN;
 		obj_list[nr].obj = obj;
diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c
index ba38ac9b1..05315ea7c 100644
--- a/builtin/verify-commit.c
+++ b/builtin/verify-commit.c
@@ -49,7 +49,7 @@ static int verify_commit(const char *name, unsigned flags)
 		return error("%s: unable to read file.", name);
 	if (type != OBJ_COMMIT)
 		return error("%s: cannot verify a non-commit object of type %s.",
-				name, typename(type));
+				name, type_name(type));
 
 	ret = run_gpg_verify(&oid, buf, size, flags);
 
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 3310fd210..bb788494f 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -203,7 +203,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
 		return error("cannot find the current offset");
 
 	header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
-			       typename(type), (uintmax_t)size) + 1;
+			       type_name(type), (uintmax_t)size) + 1;
 	git_SHA1_Init(&ctx);
 	git_SHA1_Update(&ctx, obuf, header_len);
 
diff --git a/commit.c b/commit.c
index ff51c9f34..cd9ace105 100644
--- a/commit.c
+++ b/commit.c
@@ -274,7 +274,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
 			    oid_to_hex(&commit->object.oid));
 		if (type != OBJ_COMMIT)
 			die("expected commit for %s, got %s",
-			    oid_to_hex(&commit->object.oid), typename(type));
+			    oid_to_hex(&commit->object.oid), type_name(type));
 		if (sizep)
 			*sizep = size;
 	}
diff --git a/contrib/examples/builtin-fetch--tool.c b/contrib/examples/builtin-fetch--tool.c
index a3eb19de0..22648c3af 100644
--- a/contrib/examples/builtin-fetch--tool.c
+++ b/contrib/examples/builtin-fetch--tool.c
@@ -15,7 +15,7 @@ static char *get_stdin(void)
 
 static void show_new(enum object_type type, unsigned char *sha1_new)
 {
-	fprintf(stderr, "  %s: %s\n", typename(type),
+	fprintf(stderr, "  %s: %s\n", type_name(type),
 		find_unique_abbrev(sha1_new, DEFAULT_ABBREV));
 }
 
diff --git a/fast-import.c b/fast-import.c
index b70ac025e..92b89d191 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1096,7 +1096,7 @@ static int store_object(
 	git_zstream s;
 
 	hdrlen = xsnprintf((char *)hdr, sizeof(hdr), "%s %lu",
-			   typename(type), (unsigned long)dat->len) + 1;
+			   type_name(type), (unsigned long)dat->len) + 1;
 	git_SHA1_Init(&c);
 	git_SHA1_Update(&c, hdr, hdrlen);
 	git_SHA1_Update(&c, dat->buf, dat->len);
@@ -2421,7 +2421,7 @@ static void file_change_m(const char *p, struct branch *b)
 		else if (oe) {
 			if (oe->type != OBJ_COMMIT)
 				die("Not a commit (actually a %s): %s",
-					typename(oe->type), command_buf.buf);
+					type_name(oe->type), command_buf.buf);
 		}
 		/*
 		 * Accept the sha1 without checking; it expected to be in
@@ -2448,7 +2448,7 @@ static void file_change_m(const char *p, struct branch *b)
 					command_buf.buf);
 		if (type != expected)
 			die("Not a %s (actually a %s): %s",
-				typename(expected), typename(type),
+				type_name(expected), type_name(type),
 				command_buf.buf);
 	}
 
@@ -2599,14 +2599,14 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
 	} else if (oe) {
 		if (oe->type != OBJ_BLOB)
 			die("Not a blob (actually a %s): %s",
-				typename(oe->type), command_buf.buf);
+				type_name(oe->type), command_buf.buf);
 	} else if (!is_null_oid(&oid)) {
 		enum object_type type = sha1_object_info(oid.hash, NULL);
 		if (type < 0)
 			die("Blob not found: %s", command_buf.buf);
 		if (type != OBJ_BLOB)
 			die("Not a blob (actually a %s): %s",
-			    typename(type), command_buf.buf);
+			    type_name(type), command_buf.buf);
 	}
 
 	construct_path_with_fanout(oid_to_hex(&commit_oid), *old_fanout, path);
@@ -2914,7 +2914,7 @@ static void parse_new_tag(const char *arg)
 		    "object %s\n"
 		    "type %s\n"
 		    "tag %s\n",
-		    oid_to_hex(&oid), typename(type), t->name);
+		    oid_to_hex(&oid), type_name(type), t->name);
 	if (tagger)
 		strbuf_addf(&new_data,
 			    "tagger %s\n", tagger);
@@ -2985,10 +2985,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
 		die("Can't read object %s", oid_to_hex(oid));
 	if (type != OBJ_BLOB)
 		die("Object %s is a %s but a blob was expected.",
-		    oid_to_hex(oid), typename(type));
+		    oid_to_hex(oid), type_name(type));
 	strbuf_reset(&line);
 	strbuf_addf(&line, "%s %s %lu\n", oid_to_hex(oid),
-						typename(type), size);
+						type_name(type), size);
 	cat_blob_write(line.buf, line.len);
 	strbuf_release(&line);
 	cat_blob_write(buf, size);
diff --git a/fsck.c b/fsck.c
index 032699e9a..5c8c12dde 100644
--- a/fsck.c
+++ b/fsck.c
@@ -821,7 +821,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
 			ret = report(options, &tag->object,
 				FSCK_MSG_TAG_OBJECT_NOT_TAG,
 				"expected tag got %s",
-			    typename(type));
+			    type_name(type));
 			goto done;
 		}
 	}
diff --git a/http-push.c b/http-push.c
index 14435ab65..8814aa12e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -362,7 +362,7 @@ static void start_put(struct transfer_request *request)
 	git_zstream stream;
 
 	unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
-	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
 
 	/* Set it up */
 	git_deflate_init(&stream, zlib_compression_level);
diff --git a/log-tree.c b/log-tree.c
index fca29d479..2eeddbeb3 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -499,7 +499,7 @@ static void show_one_mergetag(struct commit *commit,
 	int status, nth;
 	size_t payload_size, gpg_message_offset;
 
-	hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
+	hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);
 	tag = lookup_tag(&oid);
 	if (!tag)
 		return; /* error message already given */
diff --git a/object.c b/object.c
index 0afdfd19b..0db33b26b 100644
--- a/object.c
+++ b/object.c
@@ -26,7 +26,7 @@ static const char *object_type_strings[] = {
 	"tag",		/* OBJ_TAG = 4 */
 };
 
-const char *typename(unsigned int type)
+const char *type_name(unsigned int type)
 {
 	if (type >= ARRAY_SIZE(object_type_strings))
 		return NULL;
@@ -166,7 +166,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
 		if (!quiet)
 			error("object %s is a %s, not a %s",
 			      oid_to_hex(&obj->oid),
-			      typename(obj->type), typename(type));
+			      type_name(obj->type), type_name(type));
 		return NULL;
 	}
 }
@@ -265,7 +265,7 @@ struct object *parse_object(const struct object_id *oid)
 
 	buffer = read_sha1_file(oid->hash, &type, &size);
 	if (buffer) {
-		if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
+		if (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {
 			free(buffer);
 			error("sha1 mismatch %s", sha1_to_hex(repl));
 			return NULL;
diff --git a/object.h b/object.h
index 87563d905..a5eb26380 100644
--- a/object.h
+++ b/object.h
@@ -53,7 +53,7 @@ struct object {
 	struct object_id oid;
 };
 
-extern const char *typename(unsigned int type);
+extern const char *type_name(unsigned int type);
 extern int type_from_string_gently(const char *str, ssize_t, int gentle);
 #define type_from_string(str) type_from_string_gently(str, -1, 0)
 
diff --git a/pack-check.c b/pack-check.c
index 073c1fbd4..bd348592f 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -141,7 +141,7 @@ static int verify_packfile(struct packed_git *p,
 			err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
 				    oid_to_hex(entries[i].oid.oid), p->pack_name,
 				    (uintmax_t)entries[i].offset);
-		else if (check_sha1_signature(entries[i].oid.hash, data, size, typename(type)))
+		else if (check_sha1_signature(entries[i].oid.hash, data, size, type_name(type)))
 			err = error("packed %s from %s is corrupt",
 				    oid_to_hex(entries[i].oid.oid), p->pack_name);
 		else if (fn) {
diff --git a/packfile.c b/packfile.c
index 6657a0a49..0532a371b 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1357,7 +1357,7 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
 		if (oi->typep)
 			*oi->typep = ptot;
 		if (oi->type_name) {
-			const char *tn = typename(ptot);
+			const char *tn = type_name(ptot);
 			if (tn)
 				strbuf_addstr(oi->type_name, tn);
 		}
diff --git a/reachable.c b/reachable.c
index 88d7d679d..191ebe3e6 100644
--- a/reachable.c
+++ b/reachable.c
@@ -94,7 +94,7 @@ static void add_recent_object(const struct object_id *oid,
 		break;
 	default:
 		die("unknown object type for %s: %s",
-		    oid_to_hex(oid), typename(type));
+		    oid_to_hex(oid), type_name(type));
 	}
 
 	if (!obj)
diff --git a/ref-filter.c b/ref-filter.c
index f9e25aea7..9dae6cfe3 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -769,7 +769,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
 		if (deref)
 			name++;
 		if (!strcmp(name, "objecttype"))
-			v->s = typename(obj->type);
+			v->s = type_name(obj->type);
 		else if (!strcmp(name, "objectsize")) {
 			v->value = sz;
 			v->s = xstrfmt("%lu", sz);
@@ -795,7 +795,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
 		if (!strcmp(name, "tag"))
 			v->s = tag->tag;
 		else if (!strcmp(name, "type") && tag->tagged)
-			v->s = typename(tag->tagged->type);
+			v->s = type_name(tag->tagged->type);
 		else if (!strcmp(name, "object") && tag->tagged)
 			v->s = xstrdup(oid_to_hex(&tag->tagged->oid));
 	}
diff --git a/sequencer.c b/sequencer.c
index 4d3f60594..f6b77e6bd 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2348,7 +2348,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
 			if (!lookup_commit_reference_gently(&oid, 1)) {
 				enum object_type type = sha1_object_info(oid.hash, NULL);
 				return error(_("%s: can't cherry-pick a %s"),
-					name, typename(type));
+					name, type_name(type));
 			}
 		} else
 			return error(_("%s: bad revision"), name);
diff --git a/sha1_file.c b/sha1_file.c
index 2c03458ea..2288bb75c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -805,7 +805,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
 		return -1;
 
 	/* Generate the header */
-	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(obj_type), size) + 1;
+	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(obj_type), size) + 1;
 
 	/* Sha1.. */
 	git_SHA1_Init(&c);
@@ -1240,7 +1240,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
 			if (oi->delta_base_sha1)
 				hashclr(oi->delta_base_sha1);
 			if (oi->type_name)
-				strbuf_addstr(oi->type_name, typename(co->type));
+				strbuf_addstr(oi->type_name, type_name(co->type));
 			if (oi->contentp)
 				*oi->contentp = xmemdupz(co->buf, co->size);
 			oi->whence = OI_CACHED;
@@ -1317,7 +1317,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
 {
 	struct cached_object *co;
 
-	hash_sha1_file(buf, len, typename(type), sha1);
+	hash_sha1_file(buf, len, type_name(type), sha1);
 	if (has_sha1_file(sha1) || find_cached_object(sha1))
 		return 0;
 	ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
@@ -1683,7 +1683,7 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
 	buf = read_object(sha1, &type, &len);
 	if (!buf)
 		return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
-	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+	hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
 	ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
 	free(buf);
 
@@ -1767,9 +1767,9 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,
 	}
 
 	if (write_object)
-		ret = write_sha1_file(buf, size, typename(type), oid->hash);
+		ret = write_sha1_file(buf, size, type_name(type), oid->hash);
 	else
-		ret = hash_sha1_file(buf, size, typename(type), oid->hash);
+		ret = hash_sha1_file(buf, size, type_name(type), oid->hash);
 	if (re_allocated)
 		free(buf);
 	return ret;
@@ -1789,10 +1789,10 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,
 				 get_safe_crlf(flags));
 
 	if (write_object)
-		ret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
+		ret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 				      oid->hash);
 	else
-		ret = hash_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
+		ret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 				     oid->hash);
 	strbuf_release(&sbuf);
 	return ret;
@@ -1942,7 +1942,7 @@ void assert_sha1_type(const unsigned char *sha1, enum object_type expect)
 		die("%s is not a valid object", sha1_to_hex(sha1));
 	if (type != expect)
 		die("%s is not a valid '%s' object", sha1_to_hex(sha1),
-		    typename(expect));
+		    type_name(expect));
 }
 
 int for_each_file_in_obj_subdir(unsigned int subdir_nr,
@@ -2187,7 +2187,7 @@ int read_loose_object(const char *path,
 			goto out;
 		}
 		if (check_sha1_signature(expected_sha1, *contents,
-					 *size, typename(*type))) {
+					 *size, type_name(*type))) {
 			error("sha1 mismatch for %s (expected %s)", path,
 			      sha1_to_hex(expected_sha1));
 			free(*contents);
diff --git a/sha1_name.c b/sha1_name.c
index 611c7d24d..e7c18ffc2 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -381,7 +381,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
 
 	advise("  %s %s%s",
 	       find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
-	       typename(type) ? typename(type) : "unknown type",
+	       type_name(type) ? type_name(type) : "unknown type",
 	       desc.buf);
 
 	strbuf_release(&desc);
@@ -901,8 +901,8 @@ struct object *peel_to_type(const char *name, int namelen,
 			if (name)
 				error("%.*s: expected %s type, but the object "
 				      "dereferences to %s type",
-				      namelen, name, typename(expected_type),
-				      typename(o->type));
+				      namelen, name, type_name(expected_type),
+				      type_name(o->type));
 			return NULL;
 		}
 	}
diff --git a/submodule.c b/submodule.c
index 47ddc9b27..cd18400e8 100644
--- a/submodule.c
+++ b/submodule.c
@@ -831,7 +831,7 @@ static int check_has_commit(const struct object_id *oid, void *data)
 		return 0;
 	default:
 		die(_("submodule entry '%s' (%s) is a %s, not a commit"),
-		    cb->path, oid_to_hex(oid), typename(type));
+		    cb->path, oid_to_hex(oid), type_name(type));
 	}
 }
 
diff --git a/tag.c b/tag.c
index fcbe012f7..66210fd47 100644
--- a/tag.c
+++ b/tag.c
@@ -47,7 +47,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
 				name_to_report ?
 				name_to_report :
 				find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
-				typename(type));
+				type_name(type));
 
 	buf = read_sha1_file(oid->hash, &type, &size);
 	if (!buf)
diff --git a/walker.c b/walker.c
index 5d4d3733f..dffb9c8e3 100644
--- a/walker.c
+++ b/walker.c
@@ -22,7 +22,7 @@ void walker_say(struct walker *walker, const char *fmt, ...)
 static void report_missing(const struct object *obj)
 {
 	fprintf(stderr, "Cannot obtain needed %s %s\n",
-		obj->type ? typename(obj->type): "object",
+		obj->type ? type_name(obj->type): "object",
 		oid_to_hex(&obj->oid));
 	if (!is_null_oid(&current_commit_oid))
 		fprintf(stderr, "while processing commit %s.\n",
@@ -134,7 +134,7 @@ static int process_object(struct walker *walker, struct object *obj)
 	}
 	return error("Unable to determine requirements "
 		     "of type %s for %s",
-		     typename(obj->type), oid_to_hex(&obj->oid));
+		     type_name(obj->type), oid_to_hex(&obj->oid));
 }
 
 static int process(struct walker *walker, struct object *obj)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 03/37] blame: rename 'this' variables
  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   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 04/37] pack-objects: " Brandon Williams
                     ` (34 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 blame.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/blame.c b/blame.c
index 2893f3c10..21c867664 100644
--- a/blame.c
+++ b/blame.c
@@ -998,28 +998,29 @@ unsigned blame_entry_score(struct blame_scoreboard *sb, struct blame_entry *e)
 }
 
 /*
- * best_so_far[] and this[] are both a split of an existing blame_entry
- * that passes blame to the parent.  Maintain best_so_far the best split
- * so far, by comparing this and best_so_far and copying this into
+ * best_so_far[] and potential[] are both a split of an existing blame_entry
+ * that passes blame to the parent.  Maintain best_so_far the best split so
+ * far, by comparing potential and best_so_far and copying potential into
  * bst_so_far as needed.
  */
 static void copy_split_if_better(struct blame_scoreboard *sb,
 				 struct blame_entry *best_so_far,
-				 struct blame_entry *this)
+				 struct blame_entry *potential)
 {
 	int i;
 
-	if (!this[1].suspect)
+	if (!potential[1].suspect)
 		return;
 	if (best_so_far[1].suspect) {
-		if (blame_entry_score(sb, &this[1]) < blame_entry_score(sb, &best_so_far[1]))
+		if (blame_entry_score(sb, &potential[1]) <
+		    blame_entry_score(sb, &best_so_far[1]))
 			return;
 	}
 
 	for (i = 0; i < 3; i++)
-		blame_origin_incref(this[i].suspect);
+		blame_origin_incref(potential[i].suspect);
 	decref_split(best_so_far);
-	memcpy(best_so_far, this, sizeof(struct blame_entry [3]));
+	memcpy(best_so_far, potential, sizeof(struct blame_entry[3]));
 }
 
 /*
@@ -1046,12 +1047,12 @@ static void handle_split(struct blame_scoreboard *sb,
 	if (ent->num_lines <= tlno)
 		return;
 	if (tlno < same) {
-		struct blame_entry this[3];
+		struct blame_entry potential[3];
 		tlno += ent->s_lno;
 		same += ent->s_lno;
-		split_overlap(this, ent, tlno, plno, same, parent);
-		copy_split_if_better(sb, split, this);
-		decref_split(this);
+		split_overlap(potential, ent, tlno, plno, same, parent);
+		copy_split_if_better(sb, split, potential);
+		decref_split(potential);
 	}
 }
 
@@ -1273,7 +1274,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
 			struct diff_filepair *p = diff_queued_diff.queue[i];
 			struct blame_origin *norigin;
 			mmfile_t file_p;
-			struct blame_entry this[3];
+			struct blame_entry potential[3];
 
 			if (!DIFF_FILE_VALID(p->one))
 				continue; /* does not exist in parent */
@@ -1292,10 +1293,10 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
 
 			for (j = 0; j < num_ents; j++) {
 				find_copy_in_blob(sb, blame_list[j].ent,
-						  norigin, this, &file_p);
+						  norigin, potential, &file_p);
 				copy_split_if_better(sb, blame_list[j].split,
-						     this);
-				decref_split(this);
+						     potential);
+				decref_split(potential);
 			}
 			blame_origin_decref(norigin);
 		}
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 04/37] pack-objects: rename 'this' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (2 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 03/37] blame: rename 'this' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 05/37] rev-parse: rename 'this' variable Brandon Williams
                     ` (33 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/pack-objects.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 6b9cfc289..bfda8602c 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1376,10 +1376,10 @@ static void cleanup_preferred_base(void)
 	it = pbase_tree;
 	pbase_tree = NULL;
 	while (it) {
-		struct pbase_tree *this = it;
-		it = this->next;
-		free(this->pcache.tree_data);
-		free(this);
+		struct pbase_tree *tmp = it;
+		it = tmp->next;
+		free(tmp->pcache.tree_data);
+		free(tmp);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(pbase_tree_cache); i++) {
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 05/37] rev-parse: rename 'this' variable
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (3 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 04/37] pack-objects: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 06/37] diff: rename 'this' variables Brandon Williams
                     ` (32 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/rev-parse.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 74aa644cb..171c7a2b4 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -243,28 +243,28 @@ static int show_file(const char *arg, int output_prefix)
 static int try_difference(const char *arg)
 {
 	char *dotdot;
-	struct object_id oid;
-	struct object_id end;
-	const char *next;
-	const char *this;
+	struct object_id start_oid;
+	struct object_id end_oid;
+	const char *end;
+	const char *start;
 	int symmetric;
 	static const char head_by_default[] = "HEAD";
 
 	if (!(dotdot = strstr(arg, "..")))
 		return 0;
-	next = dotdot + 2;
-	this = arg;
-	symmetric = (*next == '.');
+	end = dotdot + 2;
+	start = arg;
+	symmetric = (*end == '.');
 
 	*dotdot = 0;
-	next += symmetric;
+	end += symmetric;
 
-	if (!*next)
-		next = head_by_default;
+	if (!*end)
+		end = head_by_default;
 	if (dotdot == arg)
-		this = head_by_default;
+		start = head_by_default;
 
-	if (this == head_by_default && next == head_by_default &&
+	if (start == head_by_default && end == head_by_default &&
 	    !symmetric) {
 		/*
 		 * Just ".."?  That is not a range but the
@@ -274,14 +274,14 @@ static int try_difference(const char *arg)
 		return 0;
 	}
 
-	if (!get_oid_committish(this, &oid) && !get_oid_committish(next, &end)) {
-		show_rev(NORMAL, &end, next);
-		show_rev(symmetric ? NORMAL : REVERSED, &oid, this);
+	if (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {
+		show_rev(NORMAL, &end_oid, end);
+		show_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);
 		if (symmetric) {
 			struct commit_list *exclude;
 			struct commit *a, *b;
-			a = lookup_commit_reference(&oid);
-			b = lookup_commit_reference(&end);
+			a = lookup_commit_reference(&start_oid);
+			b = lookup_commit_reference(&end_oid);
 			exclude = get_merge_bases(a, b);
 			while (exclude) {
 				struct commit *commit = pop_commit(&exclude);
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 06/37] diff: rename 'this' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (4 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 05/37] rev-parse: rename 'this' variable Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 21:19     ` Junio C Hamano
  2018-02-14 18:59   ` [PATCH v2 07/37] apply: rename 'try' variables Brandon Williams
                     ` (31 subsequent siblings)
  37 siblings, 1 reply; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 diff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/diff.c b/diff.c
index 0a9a0cdf1..d682d0d1f 100644
--- a/diff.c
+++ b/diff.c
@@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
 	while (dir->nr) {
 		struct dirstat_file *f = dir->files;
 		int namelen = strlen(f->name);
-		unsigned long this;
+		unsigned long sum;
 		char *slash;
 
 		if (namelen < baselen)
@@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
 		slash = strchr(f->name + baselen, '/');
 		if (slash) {
 			int newbaselen = slash + 1 - f->name;
-			this = gather_dirstat(opt, dir, changed, f->name, newbaselen);
+			sum = gather_dirstat(opt, dir, changed, f->name, newbaselen);
 			sources++;
 		} else {
-			this = f->changed;
+			sum = f->changed;
 			dir->files++;
 			dir->nr--;
 			sources += 2;
 		}
-		this_dir += this;
+		this_dir += sum;
 	}
 
 	/*
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 07/37] apply: rename 'try' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (5 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 06/37] diff: rename 'this' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 08/37] apply: rename 'new' variables Brandon Williams
                     ` (30 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 apply.c | 68 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/apply.c b/apply.c
index 321a9fa68..071f653c6 100644
--- a/apply.c
+++ b/apply.c
@@ -2386,8 +2386,8 @@ static void update_pre_post_images(struct image *preimage,
 static int line_by_line_fuzzy_match(struct image *img,
 				    struct image *preimage,
 				    struct image *postimage,
-				    unsigned long try,
-				    int try_lno,
+				    unsigned long current,
+				    int current_lno,
 				    int preimage_limit)
 {
 	int i;
@@ -2404,9 +2404,9 @@ static int line_by_line_fuzzy_match(struct image *img,
 
 	for (i = 0; i < preimage_limit; i++) {
 		size_t prelen = preimage->line[i].len;
-		size_t imglen = img->line[try_lno+i].len;
+		size_t imglen = img->line[current_lno+i].len;
 
-		if (!fuzzy_matchlines(img->buf + try + imgoff, imglen,
+		if (!fuzzy_matchlines(img->buf + current + imgoff, imglen,
 				      preimage->buf + preoff, prelen))
 			return 0;
 		if (preimage->line[i].flag & LINE_COMMON)
@@ -2443,7 +2443,7 @@ static int line_by_line_fuzzy_match(struct image *img,
 	 */
 	extra_chars = preimage_end - preimage_eof;
 	strbuf_init(&fixed, imgoff + extra_chars);
-	strbuf_add(&fixed, img->buf + try, imgoff);
+	strbuf_add(&fixed, img->buf + current, imgoff);
 	strbuf_add(&fixed, preimage_eof, extra_chars);
 	fixed_buf = strbuf_detach(&fixed, &fixed_len);
 	update_pre_post_images(preimage, postimage,
@@ -2455,8 +2455,8 @@ static int match_fragment(struct apply_state *state,
 			  struct image *img,
 			  struct image *preimage,
 			  struct image *postimage,
-			  unsigned long try,
-			  int try_lno,
+			  unsigned long current,
+			  int current_lno,
 			  unsigned ws_rule,
 			  int match_beginning, int match_end)
 {
@@ -2466,12 +2466,12 @@ static int match_fragment(struct apply_state *state,
 	size_t fixed_len, postlen;
 	int preimage_limit;
 
-	if (preimage->nr + try_lno <= img->nr) {
+	if (preimage->nr + current_lno <= img->nr) {
 		/*
 		 * The hunk falls within the boundaries of img.
 		 */
 		preimage_limit = preimage->nr;
-		if (match_end && (preimage->nr + try_lno != img->nr))
+		if (match_end && (preimage->nr + current_lno != img->nr))
 			return 0;
 	} else if (state->ws_error_action == correct_ws_error &&
 		   (ws_rule & WS_BLANK_AT_EOF)) {
@@ -2482,7 +2482,7 @@ static int match_fragment(struct apply_state *state,
 		 * match with img, and the remainder of the preimage
 		 * must be blank.
 		 */
-		preimage_limit = img->nr - try_lno;
+		preimage_limit = img->nr - current_lno;
 	} else {
 		/*
 		 * The hunk extends beyond the end of the img and
@@ -2492,27 +2492,27 @@ static int match_fragment(struct apply_state *state,
 		return 0;
 	}
 
-	if (match_beginning && try_lno)
+	if (match_beginning && current_lno)
 		return 0;
 
 	/* Quick hash check */
 	for (i = 0; i < preimage_limit; i++)
-		if ((img->line[try_lno + i].flag & LINE_PATCHED) ||
-		    (preimage->line[i].hash != img->line[try_lno + i].hash))
+		if ((img->line[current_lno + i].flag & LINE_PATCHED) ||
+		    (preimage->line[i].hash != img->line[current_lno + i].hash))
 			return 0;
 
 	if (preimage_limit == preimage->nr) {
 		/*
 		 * Do we have an exact match?  If we were told to match
-		 * at the end, size must be exactly at try+fragsize,
-		 * otherwise try+fragsize must be still within the preimage,
+		 * at the end, size must be exactly at current+fragsize,
+		 * otherwise current+fragsize must be still within the preimage,
 		 * and either case, the old piece should match the preimage
 		 * exactly.
 		 */
 		if ((match_end
-		     ? (try + preimage->len == img->len)
-		     : (try + preimage->len <= img->len)) &&
-		    !memcmp(img->buf + try, preimage->buf, preimage->len))
+		     ? (current + preimage->len == img->len)
+		     : (current + preimage->len <= img->len)) &&
+		    !memcmp(img->buf + current, preimage->buf, preimage->len))
 			return 1;
 	} else {
 		/*
@@ -2543,7 +2543,7 @@ static int match_fragment(struct apply_state *state,
 	 */
 	if (state->ws_ignore_action == ignore_ws_change)
 		return line_by_line_fuzzy_match(img, preimage, postimage,
-						try, try_lno, preimage_limit);
+						current, current_lno, preimage_limit);
 
 	if (state->ws_error_action != correct_ws_error)
 		return 0;
@@ -2577,10 +2577,10 @@ static int match_fragment(struct apply_state *state,
 	 */
 	strbuf_init(&fixed, preimage->len + 1);
 	orig = preimage->buf;
-	target = img->buf + try;
+	target = img->buf + current;
 	for (i = 0; i < preimage_limit; i++) {
 		size_t oldlen = preimage->line[i].len;
-		size_t tgtlen = img->line[try_lno + i].len;
+		size_t tgtlen = img->line[current_lno + i].len;
 		size_t fixstart = fixed.len;
 		struct strbuf tgtfix;
 		int match;
@@ -2666,8 +2666,8 @@ static int find_pos(struct apply_state *state,
 		    int match_beginning, int match_end)
 {
 	int i;
-	unsigned long backwards, forwards, try;
-	int backwards_lno, forwards_lno, try_lno;
+	unsigned long backwards, forwards, current;
+	int backwards_lno, forwards_lno, current_lno;
 
 	/*
 	 * If match_beginning or match_end is specified, there is no
@@ -2687,25 +2687,25 @@ static int find_pos(struct apply_state *state,
 	if ((size_t) line > img->nr)
 		line = img->nr;
 
-	try = 0;
+	current = 0;
 	for (i = 0; i < line; i++)
-		try += img->line[i].len;
+		current += img->line[i].len;
 
 	/*
 	 * There's probably some smart way to do this, but I'll leave
 	 * that to the smart and beautiful people. I'm simple and stupid.
 	 */
-	backwards = try;
+	backwards = current;
 	backwards_lno = line;
-	forwards = try;
+	forwards = current;
 	forwards_lno = line;
-	try_lno = line;
+	current_lno = line;
 
 	for (i = 0; ; i++) {
 		if (match_fragment(state, img, preimage, postimage,
-				   try, try_lno, ws_rule,
+				   current, current_lno, ws_rule,
 				   match_beginning, match_end))
-			return try_lno;
+			return current_lno;
 
 	again:
 		if (backwards_lno == 0 && forwards_lno == img->nr)
@@ -2718,8 +2718,8 @@ static int find_pos(struct apply_state *state,
 			}
 			backwards_lno--;
 			backwards -= img->line[backwards_lno].len;
-			try = backwards;
-			try_lno = backwards_lno;
+			current = backwards;
+			current_lno = backwards_lno;
 		} else {
 			if (forwards_lno == img->nr) {
 				i++;
@@ -2727,8 +2727,8 @@ static int find_pos(struct apply_state *state,
 			}
 			forwards += img->line[forwards_lno].len;
 			forwards_lno++;
-			try = forwards;
-			try_lno = forwards_lno;
+			current = forwards;
+			current_lno = forwards_lno;
 		}
 
 	}
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 08/37] apply: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (6 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 07/37] apply: rename 'try' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 21:40     ` Stefan Beller
  2018-02-14 18:59   ` [PATCH v2 09/37] checkout: " Brandon Williams
                     ` (29 subsequent siblings)
  37 siblings, 1 reply; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 apply.c | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/apply.c b/apply.c
index 071f653c6..e9f34dceb 100644
--- a/apply.c
+++ b/apply.c
@@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,
 				   size_t len, size_t postlen)
 {
 	int i, ctx, reduced;
-	char *new, *old, *fixed;
+	char *new_buf, *old_buf, *fixed;
 	struct image fixed_preimage;
 
 	/*
@@ -2327,25 +2327,25 @@ static void update_pre_post_images(struct image *preimage,
 	 * We trust the caller to tell us if the update can be done
 	 * in place (postlen==0) or not.
 	 */
-	old = postimage->buf;
+	old_buf = postimage->buf;
 	if (postlen)
-		new = postimage->buf = xmalloc(postlen);
+		new_buf = postimage->buf = xmalloc(postlen);
 	else
-		new = old;
+		new_buf = old_buf;
 	fixed = preimage->buf;
 
 	for (i = reduced = ctx = 0; i < postimage->nr; i++) {
 		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, l_len);
-			old += l_len;
-			new += l_len;
+			memmove(new_buf, old_buf, l_len);
+			old_buf += l_len;
+			new_buf += l_len;
 			continue;
 		}
 
 		/* a common context -- skip it in the original postimage */
-		old += l_len;
+		old_buf += l_len;
 
 		/* and find the corresponding one in the fixed preimage */
 		while (ctx < preimage->nr &&
@@ -2365,21 +2365,21 @@ static void update_pre_post_images(struct image *preimage,
 
 		/* and copy it in, while fixing the line length */
 		l_len = preimage->line[ctx].len;
-		memcpy(new, fixed, l_len);
-		new += l_len;
+		memcpy(new_buf, fixed, l_len);
+		new_buf += l_len;
 		fixed += l_len;
 		postimage->line[i].len = l_len;
 		ctx++;
 	}
 
 	if (postlen
-	    ? postlen < new - postimage->buf
-	    : postimage->len < new - postimage->buf)
+	    ? postlen < new_buf - postimage->buf
+	    : postimage->len < new_buf - postimage->buf)
 		die("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d",
-		    (int)postlen, (int) postimage->len, (int)(new - postimage->buf));
+		    (int)postlen, (int) postimage->len, (int)(new_buf - postimage->buf));
 
 	/* Fix the length of the whole thing */
-	postimage->len = new - postimage->buf;
+	postimage->len = new_buf - postimage->buf;
 	postimage->nr -= reduced;
 }
 
@@ -4163,30 +4163,30 @@ static void show_mode_change(struct patch *p, int show_name)
 static void show_rename_copy(struct patch *p)
 {
 	const char *renamecopy = p->is_rename ? "rename" : "copy";
-	const char *old, *new;
+	const char *old_name, *new_name;
 
 	/* Find common prefix */
-	old = p->old_name;
-	new = p->new_name;
+	old_name = p->old_name;
+	new_name = p->new_name;
 	while (1) {
 		const char *slash_old, *slash_new;
-		slash_old = strchr(old, '/');
-		slash_new = strchr(new, '/');
+		slash_old = strchr(old_name, '/');
+		slash_new = strchr(new_name, '/');
 		if (!slash_old ||
 		    !slash_new ||
-		    slash_old - old != slash_new - new ||
-		    memcmp(old, new, slash_new - new))
+		    slash_old - old_name != slash_new - new_name ||
+		    memcmp(old_name, new_name, slash_new - new_name))
 			break;
-		old = slash_old + 1;
-		new = slash_new + 1;
+		old_name = slash_old + 1;
+		new_name = slash_new + 1;
 	}
-	/* p->old_name thru old is the common prefix, and old and new
+	/* p->old_name thru old_name is the common prefix, and old_name and new_name
 	 * through the end of names are renames
 	 */
-	if (old != p->old_name)
+	if (old_name != p->old_name)
 		printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy,
-		       (int)(old - p->old_name), p->old_name,
-		       old, new, p->score);
+		       (int)(old_name - p->old_name), p->old_name,
+		       old_name, new_name, p->score);
 	else
 		printf(" %s %s => %s (%d%%)\n", renamecopy,
 		       p->old_name, p->new_name, p->score);
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 09/37] checkout: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (7 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 08/37] apply: rename 'new' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 10/37] help: " Brandon Williams
                     ` (28 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/checkout.c | 196 ++++++++++++++++++++++-----------------------
 1 file changed, 98 insertions(+), 98 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index c54c78df5..ed3d655f2 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -54,14 +54,14 @@ struct checkout_opts {
 	struct tree *source_tree;
 };
 
-static int post_checkout_hook(struct commit *old, struct commit *new,
+static int post_checkout_hook(struct commit *old_commit, struct commit *new_commit,
 			      int changed)
 {
 	return run_hook_le(NULL, "post-checkout",
-			   oid_to_hex(old ? &old->object.oid : &null_oid),
-			   oid_to_hex(new ? &new->object.oid : &null_oid),
+			   oid_to_hex(old_commit ? &old_commit->object.oid : &null_oid),
+			   oid_to_hex(new_commit ? &new_commit->object.oid : &null_oid),
 			   changed ? "1" : "0", NULL);
-	/* "new" can be NULL when checking out from the index before
+	/* "new_commit" can be NULL when checking out from the index before
 	   a commit exists. */
 
 }
@@ -472,8 +472,8 @@ static void setup_branch_path(struct branch_info *branch)
 }
 
 static int merge_working_tree(const struct checkout_opts *opts,
-			      struct branch_info *old,
-			      struct branch_info *new,
+			      struct branch_info *old_branch_info,
+			      struct branch_info *new_branch_info,
 			      int *writeout_error)
 {
 	int ret;
@@ -485,7 +485,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
 
 	resolve_undo_clear();
 	if (opts->force) {
-		ret = reset_tree(new->commit->tree, opts, 1, writeout_error);
+		ret = reset_tree(new_branch_info->commit->tree, opts, 1, writeout_error);
 		if (ret)
 			return ret;
 	} else {
@@ -511,7 +511,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
 		topts.initial_checkout = is_cache_unborn();
 		topts.update = 1;
 		topts.merge = 1;
-		topts.gently = opts->merge && old->commit;
+		topts.gently = opts->merge && old_branch_info->commit;
 		topts.verbose_update = opts->show_progress;
 		topts.fn = twoway_merge;
 		if (opts->overwrite_ignore) {
@@ -519,11 +519,11 @@ static int merge_working_tree(const struct checkout_opts *opts,
 			topts.dir->flags |= DIR_SHOW_IGNORED;
 			setup_standard_excludes(topts.dir);
 		}
-		tree = parse_tree_indirect(old->commit ?
-					   &old->commit->object.oid :
+		tree = parse_tree_indirect(old_branch_info->commit ?
+					   &old_branch_info->commit->object.oid :
 					   the_hash_algo->empty_tree);
 		init_tree_desc(&trees[0], tree->buffer, tree->size);
-		tree = parse_tree_indirect(&new->commit->object.oid);
+		tree = parse_tree_indirect(&new_branch_info->commit->object.oid);
 		init_tree_desc(&trees[1], tree->buffer, tree->size);
 
 		ret = unpack_trees(2, trees, &topts);
@@ -540,10 +540,10 @@ static int merge_working_tree(const struct checkout_opts *opts,
 				return 1;
 
 			/*
-			 * Without old->commit, the below is the same as
+			 * Without old_branch_info->commit, the below is the same as
 			 * the two-tree unpack we already tried and failed.
 			 */
-			if (!old->commit)
+			if (!old_branch_info->commit)
 				return 1;
 
 			/* Do more real merge */
@@ -571,18 +571,18 @@ static int merge_working_tree(const struct checkout_opts *opts,
 			o.verbosity = 0;
 			work = write_tree_from_memory(&o);
 
-			ret = reset_tree(new->commit->tree, opts, 1,
+			ret = reset_tree(new_branch_info->commit->tree, opts, 1,
 					 writeout_error);
 			if (ret)
 				return ret;
-			o.ancestor = old->name;
-			o.branch1 = new->name;
+			o.ancestor = old_branch_info->name;
+			o.branch1 = new_branch_info->name;
 			o.branch2 = "local";
-			ret = merge_trees(&o, new->commit->tree, work,
-				old->commit->tree, &result);
+			ret = merge_trees(&o, new_branch_info->commit->tree, work,
+				old_branch_info->commit->tree, &result);
 			if (ret < 0)
 				exit(128);
-			ret = reset_tree(new->commit->tree, opts, 0,
+			ret = reset_tree(new_branch_info->commit->tree, opts, 0,
 					 writeout_error);
 			strbuf_release(&o.obuf);
 			if (ret)
@@ -600,15 +600,15 @@ static int merge_working_tree(const struct checkout_opts *opts,
 		die(_("unable to write new index file"));
 
 	if (!opts->force && !opts->quiet)
-		show_local_changes(&new->commit->object, &opts->diff_options);
+		show_local_changes(&new_branch_info->commit->object, &opts->diff_options);
 
 	return 0;
 }
 
-static void report_tracking(struct branch_info *new)
+static void report_tracking(struct branch_info *new_branch_info)
 {
 	struct strbuf sb = STRBUF_INIT;
-	struct branch *branch = branch_get(new->name);
+	struct branch *branch = branch_get(new_branch_info->name);
 
 	if (!format_tracking_info(branch, &sb))
 		return;
@@ -617,8 +617,8 @@ static void report_tracking(struct branch_info *new)
 }
 
 static void update_refs_for_switch(const struct checkout_opts *opts,
-				   struct branch_info *old,
-				   struct branch_info *new)
+				   struct branch_info *old_branch_info,
+				   struct branch_info *new_branch_info)
 {
 	struct strbuf msg = STRBUF_INIT;
 	const char *old_desc, *reflog_msg;
@@ -645,69 +645,69 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
 			free(refname);
 		}
 		else
-			create_branch(opts->new_branch, new->name,
+			create_branch(opts->new_branch, new_branch_info->name,
 				      opts->new_branch_force ? 1 : 0,
 				      opts->new_branch_force ? 1 : 0,
 				      opts->new_branch_log,
 				      opts->quiet,
 				      opts->track);
-		new->name = opts->new_branch;
-		setup_branch_path(new);
+		new_branch_info->name = opts->new_branch;
+		setup_branch_path(new_branch_info);
 	}
 
-	old_desc = old->name;
-	if (!old_desc && old->commit)
-		old_desc = oid_to_hex(&old->commit->object.oid);
+	old_desc = old_branch_info->name;
+	if (!old_desc && old_branch_info->commit)
+		old_desc = oid_to_hex(&old_branch_info->commit->object.oid);
 
 	reflog_msg = getenv("GIT_REFLOG_ACTION");
 	if (!reflog_msg)
 		strbuf_addf(&msg, "checkout: moving from %s to %s",
-			old_desc ? old_desc : "(invalid)", new->name);
+			old_desc ? old_desc : "(invalid)", new_branch_info->name);
 	else
 		strbuf_insert(&msg, 0, reflog_msg, strlen(reflog_msg));
 
-	if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
+	if (!strcmp(new_branch_info->name, "HEAD") && !new_branch_info->path && !opts->force_detach) {
 		/* Nothing to do. */
-	} else if (opts->force_detach || !new->path) {	/* No longer on any branch. */
-		update_ref(msg.buf, "HEAD", &new->commit->object.oid, NULL,
+	} else if (opts->force_detach || !new_branch_info->path) {	/* No longer on any branch. */
+		update_ref(msg.buf, "HEAD", &new_branch_info->commit->object.oid, NULL,
 			   REF_NO_DEREF, UPDATE_REFS_DIE_ON_ERR);
 		if (!opts->quiet) {
-			if (old->path &&
+			if (old_branch_info->path &&
 			    advice_detached_head && !opts->force_detach)
-				detach_advice(new->name);
-			describe_detached_head(_("HEAD is now at"), new->commit);
+				detach_advice(new_branch_info->name);
+			describe_detached_head(_("HEAD is now at"), new_branch_info->commit);
 		}
-	} else if (new->path) {	/* Switch branches. */
-		if (create_symref("HEAD", new->path, msg.buf) < 0)
+	} else if (new_branch_info->path) {	/* Switch branches. */
+		if (create_symref("HEAD", new_branch_info->path, msg.buf) < 0)
 			die(_("unable to update HEAD"));
 		if (!opts->quiet) {
-			if (old->path && !strcmp(new->path, old->path)) {
+			if (old_branch_info->path && !strcmp(new_branch_info->path, old_branch_info->path)) {
 				if (opts->new_branch_force)
 					fprintf(stderr, _("Reset branch '%s'\n"),
-						new->name);
+						new_branch_info->name);
 				else
 					fprintf(stderr, _("Already on '%s'\n"),
-						new->name);
+						new_branch_info->name);
 			} else if (opts->new_branch) {
 				if (opts->branch_exists)
-					fprintf(stderr, _("Switched to and reset branch '%s'\n"), new->name);
+					fprintf(stderr, _("Switched to and reset branch '%s'\n"), new_branch_info->name);
 				else
-					fprintf(stderr, _("Switched to a new branch '%s'\n"), new->name);
+					fprintf(stderr, _("Switched to a new branch '%s'\n"), new_branch_info->name);
 			} else {
 				fprintf(stderr, _("Switched to branch '%s'\n"),
-					new->name);
+					new_branch_info->name);
 			}
 		}
-		if (old->path && old->name) {
-			if (!ref_exists(old->path) && reflog_exists(old->path))
-				delete_reflog(old->path);
+		if (old_branch_info->path && old_branch_info->name) {
+			if (!ref_exists(old_branch_info->path) && reflog_exists(old_branch_info->path))
+				delete_reflog(old_branch_info->path);
 		}
 	}
 	remove_branch_state();
 	strbuf_release(&msg);
 	if (!opts->quiet &&
-	    (new->path || (!opts->force_detach && !strcmp(new->name, "HEAD"))))
-		report_tracking(new);
+	    (new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, "HEAD"))))
+		report_tracking(new_branch_info);
 }
 
 static int add_pending_uninteresting_ref(const char *refname,
@@ -787,10 +787,10 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
  * HEAD.  If it is not reachable from any ref, this is the last chance
  * for the user to do so without resorting to reflog.
  */
-static void orphaned_commit_warning(struct commit *old, struct commit *new)
+static void orphaned_commit_warning(struct commit *old_commit, struct commit *new_commit)
 {
 	struct rev_info revs;
-	struct object *object = &old->object;
+	struct object *object = &old_commit->object;
 
 	init_revisions(&revs, NULL);
 	setup_revisions(0, NULL, &revs, NULL);
@@ -799,57 +799,57 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)
 	add_pending_object(&revs, object, oid_to_hex(&object->oid));
 
 	for_each_ref(add_pending_uninteresting_ref, &revs);
-	add_pending_oid(&revs, "HEAD", &new->object.oid, UNINTERESTING);
+	add_pending_oid(&revs, "HEAD", &new_commit->object.oid, UNINTERESTING);
 
 	if (prepare_revision_walk(&revs))
 		die(_("internal error in revision walk"));
-	if (!(old->object.flags & UNINTERESTING))
-		suggest_reattach(old, &revs);
+	if (!(old_commit->object.flags & UNINTERESTING))
+		suggest_reattach(old_commit, &revs);
 	else
-		describe_detached_head(_("Previous HEAD position was"), old);
+		describe_detached_head(_("Previous HEAD position was"), old_commit);
 
 	/* Clean up objects used, as they will be reused. */
 	clear_commit_marks_all(ALL_REV_FLAGS);
 }
 
 static int switch_branches(const struct checkout_opts *opts,
-			   struct branch_info *new)
+			   struct branch_info *new_branch_info)
 {
 	int ret = 0;
-	struct branch_info old;
+	struct branch_info old_branch_info;
 	void *path_to_free;
 	struct object_id rev;
 	int flag, writeout_error = 0;
-	memset(&old, 0, sizeof(old));
-	old.path = path_to_free = resolve_refdup("HEAD", 0, &rev, &flag);
-	if (old.path)
-		old.commit = lookup_commit_reference_gently(&rev, 1);
+	memset(&old_branch_info, 0, sizeof(old_branch_info));
+	old_branch_info.path = path_to_free = resolve_refdup("HEAD", 0, &rev, &flag);
+	if (old_branch_info.path)
+		old_branch_info.commit = lookup_commit_reference_gently(&rev, 1);
 	if (!(flag & REF_ISSYMREF))
-		old.path = NULL;
+		old_branch_info.path = NULL;
 
-	if (old.path)
-		skip_prefix(old.path, "refs/heads/", &old.name);
+	if (old_branch_info.path)
+		skip_prefix(old_branch_info.path, "refs/heads/", &old_branch_info.name);
 
-	if (!new->name) {
-		new->name = "HEAD";
-		new->commit = old.commit;
-		if (!new->commit)
+	if (!new_branch_info->name) {
+		new_branch_info->name = "HEAD";
+		new_branch_info->commit = old_branch_info.commit;
+		if (!new_branch_info->commit)
 			die(_("You are on a branch yet to be born"));
-		parse_commit_or_die(new->commit);
+		parse_commit_or_die(new_branch_info->commit);
 	}
 
-	ret = merge_working_tree(opts, &old, new, &writeout_error);
+	ret = merge_working_tree(opts, &old_branch_info, new_branch_info, &writeout_error);
 	if (ret) {
 		free(path_to_free);
 		return ret;
 	}
 
-	if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
-		orphaned_commit_warning(old.commit, new->commit);
+	if (!opts->quiet && !old_branch_info.path && old_branch_info.commit && new_branch_info->commit != old_branch_info.commit)
+		orphaned_commit_warning(old_branch_info.commit, new_branch_info->commit);
 
-	update_refs_for_switch(opts, &old, new);
+	update_refs_for_switch(opts, &old_branch_info, new_branch_info);
 
-	ret = post_checkout_hook(old.commit, new->commit, 1);
+	ret = post_checkout_hook(old_branch_info.commit, new_branch_info->commit, 1);
 	free(path_to_free);
 	return ret || writeout_error;
 }
@@ -870,7 +870,7 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
 
 static int parse_branchname_arg(int argc, const char **argv,
 				int dwim_new_local_branch_ok,
-				struct branch_info *new,
+				struct branch_info *new_branch_info,
 				struct checkout_opts *opts,
 				struct object_id *rev)
 {
@@ -988,22 +988,22 @@ static int parse_branchname_arg(int argc, const char **argv,
 	argv++;
 	argc--;
 
-	new->name = arg;
-	setup_branch_path(new);
+	new_branch_info->name = arg;
+	setup_branch_path(new_branch_info);
 
-	if (!check_refname_format(new->path, 0) &&
-	    !read_ref(new->path, &branch_rev))
+	if (!check_refname_format(new_branch_info->path, 0) &&
+	    !read_ref(new_branch_info->path, &branch_rev))
 		oidcpy(rev, &branch_rev);
 	else
-		new->path = NULL; /* not an existing branch */
+		new_branch_info->path = NULL; /* not an existing branch */
 
-	new->commit = lookup_commit_reference_gently(rev, 1);
-	if (!new->commit) {
+	new_branch_info->commit = lookup_commit_reference_gently(rev, 1);
+	if (!new_branch_info->commit) {
 		/* not a commit */
 		*source_tree = parse_tree_indirect(rev);
 	} else {
-		parse_commit_or_die(new->commit);
-		*source_tree = new->commit->tree;
+		parse_commit_or_die(new_branch_info->commit);
+		*source_tree = new_branch_info->commit->tree;
 	}
 
 	if (!*source_tree)                   /* case (1): want a tree */
@@ -1043,7 +1043,7 @@ static int switch_unborn_to_new_branch(const struct checkout_opts *opts)
 }
 
 static int checkout_branch(struct checkout_opts *opts,
-			   struct branch_info *new)
+			   struct branch_info *new_branch_info)
 {
 	if (opts->pathspec.nr)
 		die(_("paths cannot be used with switching branches"));
@@ -1072,21 +1072,21 @@ static int checkout_branch(struct checkout_opts *opts,
 	} else if (opts->track == BRANCH_TRACK_UNSPECIFIED)
 		opts->track = git_branch_track;
 
-	if (new->name && !new->commit)
+	if (new_branch_info->name && !new_branch_info->commit)
 		die(_("Cannot switch branch to a non-commit '%s'"),
-		    new->name);
+		    new_branch_info->name);
 
-	if (new->path && !opts->force_detach && !opts->new_branch &&
+	if (new_branch_info->path && !opts->force_detach && !opts->new_branch &&
 	    !opts->ignore_other_worktrees) {
 		int flag;
 		char *head_ref = resolve_refdup("HEAD", 0, NULL, &flag);
 		if (head_ref &&
-		    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))
-			die_if_checked_out(new->path, 1);
+		    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new_branch_info->path)))
+			die_if_checked_out(new_branch_info->path, 1);
 		free(head_ref);
 	}
 
-	if (!new->commit && opts->new_branch) {
+	if (!new_branch_info->commit && opts->new_branch) {
 		struct object_id rev;
 		int flag;
 
@@ -1094,13 +1094,13 @@ static int checkout_branch(struct checkout_opts *opts,
 		    (flag & REF_ISSYMREF) && is_null_oid(&rev))
 			return switch_unborn_to_new_branch(opts);
 	}
-	return switch_branches(opts, new);
+	return switch_branches(opts, new_branch_info);
 }
 
 int cmd_checkout(int argc, const char **argv, const char *prefix)
 {
 	struct checkout_opts opts;
-	struct branch_info new;
+	struct branch_info new_branch_info;
 	char *conflict_style = NULL;
 	int dwim_new_local_branch = 1;
 	struct option options[] = {
@@ -1138,7 +1138,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 	};
 
 	memset(&opts, 0, sizeof(opts));
-	memset(&new, 0, sizeof(new));
+	memset(&new_branch_info, 0, sizeof(new_branch_info));
 	opts.overwrite_ignore = 1;
 	opts.prefix = prefix;
 	opts.show_progress = -1;
@@ -1210,7 +1210,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 			opts.track == BRANCH_TRACK_UNSPECIFIED &&
 			!opts.new_branch;
 		int n = parse_branchname_arg(argc, argv, dwim_ok,
-					     &new, &opts, &rev);
+					     &new_branch_info, &opts, &rev);
 		argv += n;
 		argc -= n;
 	}
@@ -1253,7 +1253,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
 	UNLEAK(opts);
 	if (opts.patch_mode || opts.pathspec.nr)
-		return checkout_paths(&opts, new.name);
+		return checkout_paths(&opts, new_branch_info.name);
 	else
-		return checkout_branch(&opts, &new);
+		return checkout_branch(&opts, &new_branch_info);
 }
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 10/37] help: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (8 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 09/37] checkout: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 11/37] pack-redundant: " Brandon Williams
                     ` (27 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/help.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin/help.c b/builtin/help.c
index d3c8fc408..598867cfe 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -194,11 +194,11 @@ static void do_add_man_viewer_info(const char *name,
 				   size_t len,
 				   const char *value)
 {
-	struct man_viewer_info_list *new;
-	FLEX_ALLOC_MEM(new, name, name, len);
-	new->info = xstrdup(value);
-	new->next = man_viewer_info_list;
-	man_viewer_info_list = new;
+	struct man_viewer_info_list *new_man_viewer;
+	FLEX_ALLOC_MEM(new_man_viewer, name, name, len);
+	new_man_viewer->info = xstrdup(value);
+	new_man_viewer->next = man_viewer_info_list;
+	man_viewer_info_list = new_man_viewer;
 }
 
 static int add_man_viewer_path(const char *name,
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 11/37] pack-redundant: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (9 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 10/37] help: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 12/37] reflog: " Brandon Williams
                     ` (26 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/pack-redundant.c | 54 ++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index aaa813632..991e1bb76 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -48,17 +48,17 @@ static inline void llist_item_put(struct llist_item *item)
 
 static inline struct llist_item *llist_item_get(void)
 {
-	struct llist_item *new;
+	struct llist_item *new_item;
 	if ( free_nodes ) {
-		new = free_nodes;
+		new_item = free_nodes;
 		free_nodes = free_nodes->next;
 	} else {
 		int i = 1;
-		ALLOC_ARRAY(new, BLKSIZE);
+		ALLOC_ARRAY(new_item, BLKSIZE);
 		for (; i < BLKSIZE; i++)
-			llist_item_put(&new[i]);
+			llist_item_put(&new_item[i]);
 	}
-	return new;
+	return new_item;
 }
 
 static void llist_free(struct llist *list)
@@ -80,26 +80,26 @@ static inline void llist_init(struct llist **list)
 static struct llist * llist_copy(struct llist *list)
 {
 	struct llist *ret;
-	struct llist_item *new, *old, *prev;
+	struct llist_item *new_item, *old_item, *prev;
 
 	llist_init(&ret);
 
 	if ((ret->size = list->size) == 0)
 		return ret;
 
-	new = ret->front = llist_item_get();
-	new->sha1 = list->front->sha1;
+	new_item = ret->front = llist_item_get();
+	new_item->sha1 = list->front->sha1;
 
-	old = list->front->next;
-	while (old) {
-		prev = new;
-		new = llist_item_get();
-		prev->next = new;
-		new->sha1 = old->sha1;
-		old = old->next;
+	old_item = list->front->next;
+	while (old_item) {
+		prev = new_item;
+		new_item = llist_item_get();
+		prev->next = new_item;
+		new_item->sha1 = old_item->sha1;
+		old_item = old_item->next;
 	}
-	new->next = NULL;
-	ret->back = new;
+	new_item->next = NULL;
+	ret->back = new_item;
 
 	return ret;
 }
@@ -108,24 +108,24 @@ static inline struct llist_item *llist_insert(struct llist *list,
 					      struct llist_item *after,
 					       const unsigned char *sha1)
 {
-	struct llist_item *new = llist_item_get();
-	new->sha1 = sha1;
-	new->next = NULL;
+	struct llist_item *new_item = llist_item_get();
+	new_item->sha1 = sha1;
+	new_item->next = NULL;
 
 	if (after != NULL) {
-		new->next = after->next;
-		after->next = new;
+		new_item->next = after->next;
+		after->next = new_item;
 		if (after == list->back)
-			list->back = new;
+			list->back = new_item;
 	} else {/* insert in front */
 		if (list->size == 0)
-			list->back = new;
+			list->back = new_item;
 		else
-			new->next = list->front;
-		list->front = new;
+			new_item->next = list->front;
+		list->front = new_item;
 	}
 	list->size++;
-	return new;
+	return new_item;
 }
 
 static inline struct llist_item *llist_insert_back(struct llist *list,
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 12/37] reflog: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (10 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 11/37] pack-redundant: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 13/37] remote: " Brandon Williams
                     ` (25 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/reflog.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/reflog.c b/builtin/reflog.c
index 223372531..ac3dcd7a5 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -289,20 +289,20 @@ static int should_expire_reflog_ent(struct object_id *ooid, struct object_id *no
 				    const char *message, void *cb_data)
 {
 	struct expire_reflog_policy_cb *cb = cb_data;
-	struct commit *old, *new;
+	struct commit *old_commit, *new_commit;
 
 	if (timestamp < cb->cmd.expire_total)
 		return 1;
 
-	old = new = NULL;
+	old_commit = new_commit = NULL;
 	if (cb->cmd.stalefix &&
-	    (!keep_entry(&old, ooid) || !keep_entry(&new, noid)))
+	    (!keep_entry(&old_commit, ooid) || !keep_entry(&new_commit, noid)))
 		return 1;
 
 	if (timestamp < cb->cmd.expire_unreachable) {
 		if (cb->unreachable_expire_kind == UE_ALWAYS)
 			return 1;
-		if (unreachable(cb, old, ooid) || unreachable(cb, new, noid))
+		if (unreachable(cb, old_commit, ooid) || unreachable(cb, new_commit, noid))
 			return 1;
 	}
 
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 13/37] remote: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (11 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 12/37] reflog: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 14/37] combine-diff: " Brandon Williams
                     ` (24 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/remote.c | 66 ++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/builtin/remote.c b/builtin/remote.c
index d95bf904c..6487d92ab 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -322,7 +322,7 @@ static void read_branches(void)
 
 struct ref_states {
 	struct remote *remote;
-	struct string_list new, stale, tracked, heads, push;
+	struct string_list new_refs, stale, tracked, heads, push;
 	int queried;
 };
 
@@ -337,12 +337,12 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
 			die(_("Could not get fetch map for refspec %s"),
 				states->remote->fetch_refspec[i]);
 
-	states->new.strdup_strings = 1;
+	states->new_refs.strdup_strings = 1;
 	states->tracked.strdup_strings = 1;
 	states->stale.strdup_strings = 1;
 	for (ref = fetch_map; ref; ref = ref->next) {
 		if (!ref->peer_ref || !ref_exists(ref->peer_ref->name))
-			string_list_append(&states->new, abbrev_branch(ref->name));
+			string_list_append(&states->new_refs, abbrev_branch(ref->name));
 		else
 			string_list_append(&states->tracked, abbrev_branch(ref->name));
 	}
@@ -356,7 +356,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
 	free_refs(stale_refs);
 	free_refs(fetch_map);
 
-	string_list_sort(&states->new);
+	string_list_sort(&states->new_refs);
 	string_list_sort(&states->tracked);
 	string_list_sort(&states->stale);
 
@@ -546,8 +546,8 @@ static int add_branch_for_removal(const char *refname,
 }
 
 struct rename_info {
-	const char *old;
-	const char *new;
+	const char *old_name;
+	const char *new_name;
 	struct string_list *remote_branches;
 };
 
@@ -560,7 +560,7 @@ static int read_remote_branches(const char *refname,
 	int flag;
 	const char *symref;
 
-	strbuf_addf(&buf, "refs/remotes/%s/", rename->old);
+	strbuf_addf(&buf, "refs/remotes/%s/", rename->old_name);
 	if (starts_with(refname, buf.buf)) {
 		item = string_list_append(rename->remote_branches, xstrdup(refname));
 		symref = resolve_ref_unsafe(refname, RESOLVE_REF_READING,
@@ -615,36 +615,36 @@ static int mv(int argc, const char **argv)
 	if (argc != 3)
 		usage_with_options(builtin_remote_rename_usage, options);
 
-	rename.old = argv[1];
-	rename.new = argv[2];
+	rename.old_name = argv[1];
+	rename.new_name = argv[2];
 	rename.remote_branches = &remote_branches;
 
-	oldremote = remote_get(rename.old);
+	oldremote = remote_get(rename.old_name);
 	if (!remote_is_configured(oldremote, 1))
-		die(_("No such remote: %s"), rename.old);
+		die(_("No such remote: %s"), rename.old_name);
 
-	if (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)
+	if (!strcmp(rename.old_name, rename.new_name) && oldremote->origin != REMOTE_CONFIG)
 		return migrate_file(oldremote);
 
-	newremote = remote_get(rename.new);
+	newremote = remote_get(rename.new_name);
 	if (remote_is_configured(newremote, 1))
-		die(_("remote %s already exists."), rename.new);
+		die(_("remote %s already exists."), rename.new_name);
 
-	strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new);
+	strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new_name);
 	if (!valid_fetch_refspec(buf.buf))
-		die(_("'%s' is not a valid remote name"), rename.new);
+		die(_("'%s' is not a valid remote name"), rename.new_name);
 
 	strbuf_reset(&buf);
-	strbuf_addf(&buf, "remote.%s", rename.old);
-	strbuf_addf(&buf2, "remote.%s", rename.new);
+	strbuf_addf(&buf, "remote.%s", rename.old_name);
+	strbuf_addf(&buf2, "remote.%s", rename.new_name);
 	if (git_config_rename_section(buf.buf, buf2.buf) < 1)
 		return error(_("Could not rename config section '%s' to '%s'"),
 				buf.buf, buf2.buf);
 
 	strbuf_reset(&buf);
-	strbuf_addf(&buf, "remote.%s.fetch", rename.new);
+	strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
 	git_config_set_multivar(buf.buf, NULL, NULL, 1);
-	strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
+	strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name);
 	for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
 		char *ptr;
 
@@ -655,8 +655,8 @@ static int mv(int argc, const char **argv)
 			refspec_updated = 1;
 			strbuf_splice(&buf2,
 				      ptr-buf2.buf + strlen(":refs/remotes/"),
-				      strlen(rename.old), rename.new,
-				      strlen(rename.new));
+				      strlen(rename.old_name), rename.new_name,
+				      strlen(rename.new_name));
 		} else
 			warning(_("Not updating non-default fetch refspec\n"
 				  "\t%s\n"
@@ -670,10 +670,10 @@ static int mv(int argc, const char **argv)
 	for (i = 0; i < branch_list.nr; i++) {
 		struct string_list_item *item = branch_list.items + i;
 		struct branch_info *info = item->util;
-		if (info->remote_name && !strcmp(info->remote_name, rename.old)) {
+		if (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "branch.%s.remote", item->string);
-			git_config_set(buf.buf, rename.new);
+			git_config_set(buf.buf, rename.new_name);
 		}
 	}
 
@@ -703,8 +703,8 @@ static int mv(int argc, const char **argv)
 			continue;
 		strbuf_reset(&buf);
 		strbuf_addstr(&buf, item->string);
-		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old_name),
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf2);
 		strbuf_addf(&buf2, "remote: renamed %s to %s",
 				item->string, buf.buf);
@@ -718,12 +718,12 @@ static int mv(int argc, const char **argv)
 			continue;
 		strbuf_reset(&buf);
 		strbuf_addstr(&buf, item->string);
-		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old_name),
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf2);
 		strbuf_addstr(&buf2, item->util);
-		strbuf_splice(&buf2, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+		strbuf_splice(&buf2, strlen("refs/remotes/"), strlen(rename.old_name),
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf3);
 		strbuf_addf(&buf3, "remote: renamed %s to %s",
 				item->string, buf.buf);
@@ -822,7 +822,7 @@ static void clear_push_info(void *util, const char *string)
 
 static void free_remote_ref_states(struct ref_states *states)
 {
-	string_list_clear(&states->new, 0);
+	string_list_clear(&states->new_refs, 0);
 	string_list_clear(&states->stale, 1);
 	string_list_clear(&states->tracked, 0);
 	string_list_clear(&states->heads, 0);
@@ -907,7 +907,7 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)
 	if (states->queried) {
 		const char *fmt = "%s";
 		const char *arg = "";
-		if (string_list_has_string(&states->new, name)) {
+		if (string_list_has_string(&states->new_refs, name)) {
 			fmt = _(" new (next fetch will store in remotes/%s)");
 			arg = states->remote->name;
 		} else if (string_list_has_string(&states->tracked, name))
@@ -1176,7 +1176,7 @@ static int show(int argc, const char **argv)
 
 		/* remote branch info */
 		info.width = 0;
-		for_each_string_list(&states.new, add_remote_to_show_info, &info);
+		for_each_string_list(&states.new_refs, add_remote_to_show_info, &info);
 		for_each_string_list(&states.tracked, add_remote_to_show_info, &info);
 		for_each_string_list(&states.stale, add_remote_to_show_info, &info);
 		if (info.list->nr)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 14/37] combine-diff: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (12 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 13/37] remote: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 15/37] commit: " Brandon Williams
                     ` (23 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 combine-diff.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index bc08c4c5b..14db48966 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -162,7 +162,7 @@ enum coalesce_direction { MATCH, BASE, NEW };
 
 /* Coalesce new lines into base by finding LCS */
 static struct lline *coalesce_lines(struct lline *base, int *lenbase,
-				    struct lline *new, int lennew,
+				    struct lline *newline, int lennew,
 				    unsigned long parent, long flags)
 {
 	int **lcs;
@@ -170,12 +170,12 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 	struct lline *baseend, *newend = NULL;
 	int i, j, origbaselen = *lenbase;
 
-	if (new == NULL)
+	if (newline == NULL)
 		return base;
 
 	if (base == NULL) {
 		*lenbase = lennew;
-		return new;
+		return newline;
 	}
 
 	/*
@@ -200,7 +200,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 		directions[0][j] = NEW;
 
 	for (i = 1, baseend = base; i < origbaselen + 1; i++) {
-		for (j = 1, newend = new; j < lennew + 1; j++) {
+		for (j = 1, newend = newline; j < lennew + 1; j++) {
 			if (match_string_spaces(baseend->line, baseend->len,
 						newend->line, newend->len, flags)) {
 				lcs[i][j] = lcs[i - 1][j - 1] + 1;
@@ -241,7 +241,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 			if (lline->prev)
 				lline->prev->next = lline->next;
 			else
-				new = lline->next;
+				newline = lline->next;
 			if (lline->next)
 				lline->next->prev = lline->prev;
 
@@ -270,7 +270,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
 		}
 	}
 
-	newend = new;
+	newend = newline;
 	while (newend) {
 		struct lline *lline = newend;
 		newend = newend->next;
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 15/37] commit: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (13 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 14/37] combine-diff: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 16/37] diff-lib: rename 'new' variable Brandon Williams
                     ` (22 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 commit.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/commit.c b/commit.c
index cd9ace105..874b6e510 100644
--- a/commit.c
+++ b/commit.c
@@ -861,19 +861,19 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)
 	commit_list_insert(in->item, &ret);
 
 	for (i = in->next; i; i = i->next) {
-		struct commit_list *new = NULL, *end = NULL;
+		struct commit_list *new_commits = NULL, *end = NULL;
 
 		for (j = ret; j; j = j->next) {
 			struct commit_list *bases;
 			bases = get_merge_bases(i->item, j->item);
-			if (!new)
-				new = bases;
+			if (!new_commits)
+				new_commits = bases;
 			else
 				end->next = bases;
 			for (k = bases; k; k = k->next)
 				end = k;
 		}
-		ret = new;
+		ret = new_commits;
 	}
 	return ret;
 }
@@ -1617,11 +1617,11 @@ struct commit *get_merge_parent(const char *name)
 struct commit_list **commit_list_append(struct commit *commit,
 					struct commit_list **next)
 {
-	struct commit_list *new = xmalloc(sizeof(struct commit_list));
-	new->item = commit;
-	*next = new;
-	new->next = NULL;
-	return &new->next;
+	struct commit_list *new_commit = xmalloc(sizeof(struct commit_list));
+	new_commit->item = commit;
+	*next = new_commit;
+	new_commit->next = NULL;
+	return &new_commit->next;
 }
 
 const char *find_commit_header(const char *msg, const char *key, size_t *out_len)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 16/37] diff-lib: rename 'new' variable
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (14 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 15/37] commit: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 17/37] diff: rename 'new' variables Brandon Williams
                     ` (21 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 diff-lib.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/diff-lib.c b/diff-lib.c
index 8104603a3..261ce13d6 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -302,7 +302,7 @@ static int get_stat_data(const struct cache_entry *ce,
 }
 
 static void show_new_file(struct rev_info *revs,
-			  const struct cache_entry *new,
+			  const struct cache_entry *new_file,
 			  int cached, int match_missing)
 {
 	const struct object_id *oid;
@@ -313,16 +313,16 @@ static void show_new_file(struct rev_info *revs,
 	 * New file in the index: it might actually be different in
 	 * the working tree.
 	 */
-	if (get_stat_data(new, &oid, &mode, cached, match_missing,
+	if (get_stat_data(new_file, &oid, &mode, cached, match_missing,
 	    &dirty_submodule, &revs->diffopt) < 0)
 		return;
 
-	diff_index_show_file(revs, "+", new, oid, !is_null_oid(oid), mode, dirty_submodule);
+	diff_index_show_file(revs, "+", new_file, oid, !is_null_oid(oid), mode, dirty_submodule);
 }
 
 static int show_modified(struct rev_info *revs,
-			 const struct cache_entry *old,
-			 const struct cache_entry *new,
+			 const struct cache_entry *old_entry,
+			 const struct cache_entry *new_entry,
 			 int report_missing,
 			 int cached, int match_missing)
 {
@@ -330,47 +330,47 @@ static int show_modified(struct rev_info *revs,
 	const struct object_id *oid;
 	unsigned dirty_submodule = 0;
 
-	if (get_stat_data(new, &oid, &mode, cached, match_missing,
+	if (get_stat_data(new_entry, &oid, &mode, cached, match_missing,
 			  &dirty_submodule, &revs->diffopt) < 0) {
 		if (report_missing)
-			diff_index_show_file(revs, "-", old,
-					     &old->oid, 1, old->ce_mode,
+			diff_index_show_file(revs, "-", old_entry,
+					     &old_entry->oid, 1, old_entry->ce_mode,
 					     0);
 		return -1;
 	}
 
 	if (revs->combine_merges && !cached &&
-	    (oidcmp(oid, &old->oid) || oidcmp(&old->oid, &new->oid))) {
+	    (oidcmp(oid, &old_entry->oid) || oidcmp(&old_entry->oid, &new_entry->oid))) {
 		struct combine_diff_path *p;
-		int pathlen = ce_namelen(new);
+		int pathlen = ce_namelen(new_entry);
 
 		p = xmalloc(combine_diff_path_size(2, pathlen));
 		p->path = (char *) &p->parent[2];
 		p->next = NULL;
-		memcpy(p->path, new->name, pathlen);
+		memcpy(p->path, new_entry->name, pathlen);
 		p->path[pathlen] = 0;
 		p->mode = mode;
 		oidclr(&p->oid);
 		memset(p->parent, 0, 2 * sizeof(struct combine_diff_parent));
 		p->parent[0].status = DIFF_STATUS_MODIFIED;
-		p->parent[0].mode = new->ce_mode;
-		oidcpy(&p->parent[0].oid, &new->oid);
+		p->parent[0].mode = new_entry->ce_mode;
+		oidcpy(&p->parent[0].oid, &new_entry->oid);
 		p->parent[1].status = DIFF_STATUS_MODIFIED;
-		p->parent[1].mode = old->ce_mode;
-		oidcpy(&p->parent[1].oid, &old->oid);
+		p->parent[1].mode = old_entry->ce_mode;
+		oidcpy(&p->parent[1].oid, &old_entry->oid);
 		show_combined_diff(p, 2, revs->dense_combined_merges, revs);
 		free(p);
 		return 0;
 	}
 
-	oldmode = old->ce_mode;
-	if (mode == oldmode && !oidcmp(oid, &old->oid) && !dirty_submodule &&
+	oldmode = old_entry->ce_mode;
+	if (mode == oldmode && !oidcmp(oid, &old_entry->oid) && !dirty_submodule &&
 	    !revs->diffopt.flags.find_copies_harder)
 		return 0;
 
 	diff_change(&revs->diffopt, oldmode, mode,
-		    &old->oid, oid, 1, !is_null_oid(oid),
-		    old->name, 0, dirty_submodule);
+		    &old_entry->oid, oid, 1, !is_null_oid(oid),
+		    old_entry->name, 0, dirty_submodule);
 	return 0;
 }
 
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 17/37] diff: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (15 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 16/37] diff-lib: rename 'new' variable Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 18/37] diffcore-delta: " Brandon Williams
                     ` (20 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 diff.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/diff.c b/diff.c
index d682d0d1f..2de9c5ed2 100644
--- a/diff.c
+++ b/diff.c
@@ -1504,7 +1504,7 @@ struct diff_words_style_elem {
 
 struct diff_words_style {
 	enum diff_words_type type;
-	struct diff_words_style_elem new, old, ctx;
+	struct diff_words_style_elem new_word, old_word, ctx;
 	const char *newline;
 };
 
@@ -1655,12 +1655,12 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
 	}
 	if (minus_begin != minus_end) {
 		fn_out_diff_words_write_helper(diff_words->opt,
-				&style->old, style->newline,
+				&style->old_word, style->newline,
 				minus_end - minus_begin, minus_begin);
 	}
 	if (plus_begin != plus_end) {
 		fn_out_diff_words_write_helper(diff_words->opt,
-				&style->new, style->newline,
+				&style->new_word, style->newline,
 				plus_end - plus_begin, plus_begin);
 	}
 
@@ -1758,7 +1758,7 @@ static void diff_words_show(struct diff_words_data *diff_words)
 		emit_diff_symbol(diff_words->opt, DIFF_SYMBOL_WORD_DIFF,
 				 line_prefix, strlen(line_prefix), 0);
 		fn_out_diff_words_write_helper(diff_words->opt,
-			&style->old, style->newline,
+			&style->old_word, style->newline,
 			diff_words->minus.text.size,
 			diff_words->minus.text.ptr);
 		diff_words->minus.text.size = 0;
@@ -1883,8 +1883,8 @@ static void init_diff_words_data(struct emit_callback *ecbdata,
 	}
 	if (want_color(o->use_color)) {
 		struct diff_words_style *st = ecbdata->diff_words->style;
-		st->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);
-		st->new.color = diff_get_color_opt(o, DIFF_FILE_NEW);
+		st->old_word.color = diff_get_color_opt(o, DIFF_FILE_OLD);
+		st->new_word.color = diff_get_color_opt(o, DIFF_FILE_NEW);
 		st->ctx.color = diff_get_color_opt(o, DIFF_CONTEXT);
 	}
 }
@@ -2047,8 +2047,8 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
 
 static char *pprint_rename(const char *a, const char *b)
 {
-	const char *old = a;
-	const char *new = b;
+	const char *old_name = a;
+	const char *new_name = b;
 	struct strbuf name = STRBUF_INIT;
 	int pfx_length, sfx_length;
 	int pfx_adjust_for_slash;
@@ -2067,16 +2067,16 @@ static char *pprint_rename(const char *a, const char *b)
 
 	/* Find common prefix */
 	pfx_length = 0;
-	while (*old && *new && *old == *new) {
-		if (*old == '/')
-			pfx_length = old - a + 1;
-		old++;
-		new++;
+	while (*old_name && *new_name && *old_name == *new_name) {
+		if (*old_name == '/')
+			pfx_length = old_name - a + 1;
+		old_name++;
+		new_name++;
 	}
 
 	/* Find common suffix */
-	old = a + len_a;
-	new = b + len_b;
+	old_name = a + len_a;
+	new_name = b + len_b;
 	sfx_length = 0;
 	/*
 	 * If there is a common prefix, it must end in a slash.  In
@@ -2087,13 +2087,13 @@ static char *pprint_rename(const char *a, const char *b)
 	 * underrun the input strings.
 	 */
 	pfx_adjust_for_slash = (pfx_length ? 1 : 0);
-	while (a + pfx_length - pfx_adjust_for_slash <= old &&
-	       b + pfx_length - pfx_adjust_for_slash <= new &&
-	       *old == *new) {
-		if (*old == '/')
-			sfx_length = len_a - (old - a);
-		old--;
-		new--;
+	while (a + pfx_length - pfx_adjust_for_slash <= old_name &&
+	       b + pfx_length - pfx_adjust_for_slash <= new_name &&
+	       *old_name == *new_name) {
+		if (*old_name == '/')
+			sfx_length = len_a - (old_name - a);
+		old_name--;
+		new_name--;
 	}
 
 	/*
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 18/37] diffcore-delta: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (16 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 17/37] diff: rename 'new' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 19/37] entry: " Brandon Williams
                     ` (19 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 diffcore-delta.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/diffcore-delta.c b/diffcore-delta.c
index ebe70fb06..c83d45a04 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -48,16 +48,16 @@ struct spanhash_top {
 
 static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
 {
-	struct spanhash_top *new;
+	struct spanhash_top *new_spanhash;
 	int i;
 	int osz = 1 << orig->alloc_log2;
 	int sz = osz << 1;
 
-	new = xmalloc(st_add(sizeof(*orig),
+	new_spanhash = xmalloc(st_add(sizeof(*orig),
 			     st_mult(sizeof(struct spanhash), sz)));
-	new->alloc_log2 = orig->alloc_log2 + 1;
-	new->free = INITIAL_FREE(new->alloc_log2);
-	memset(new->data, 0, sizeof(struct spanhash) * sz);
+	new_spanhash->alloc_log2 = orig->alloc_log2 + 1;
+	new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);
+	memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);
 	for (i = 0; i < osz; i++) {
 		struct spanhash *o = &(orig->data[i]);
 		int bucket;
@@ -65,11 +65,11 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
 			continue;
 		bucket = o->hashval & (sz - 1);
 		while (1) {
-			struct spanhash *h = &(new->data[bucket++]);
+			struct spanhash *h = &(new_spanhash->data[bucket++]);
 			if (!h->cnt) {
 				h->hashval = o->hashval;
 				h->cnt = o->cnt;
-				new->free--;
+				new_spanhash->free--;
 				break;
 			}
 			if (sz <= bucket)
@@ -77,7 +77,7 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
 		}
 	}
 	free(orig);
-	return new;
+	return new_spanhash;
 }
 
 static struct spanhash_top *add_spanhash(struct spanhash_top *top,
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 19/37] entry: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (17 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 18/37] diffcore-delta: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 20/37] http: " Brandon Williams
                     ` (18 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 20/37] http: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (18 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 19/37] entry: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 21/37] imap-send: " Brandon Williams
                     ` (17 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 http.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/http.c b/http.c
index 597771271..41cfa41a9 100644
--- a/http.c
+++ b/http.c
@@ -1194,14 +1194,14 @@ static struct fill_chain *fill_cfg;
 
 void add_fill_function(void *data, int (*fill)(void *))
 {
-	struct fill_chain *new = xmalloc(sizeof(*new));
+	struct fill_chain *new_fill = xmalloc(sizeof(*new_fill));
 	struct fill_chain **linkp = &fill_cfg;
-	new->data = data;
-	new->fill = fill;
-	new->next = NULL;
+	new_fill->data = data;
+	new_fill->fill = fill;
+	new_fill->next = NULL;
 	while (*linkp)
 		linkp = &(*linkp)->next;
-	*linkp = new;
+	*linkp = new_fill;
 }
 
 void fill_active_slots(void)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 21/37] imap-send: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (19 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 20/37] http: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 22/37] line-log: " Brandon Williams
                     ` (16 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 imap-send.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/imap-send.c b/imap-send.c
index 36c7c1b4f..ffb0a6eca 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1189,11 +1189,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
  */
 static void lf_to_crlf(struct strbuf *msg)
 {
-	char *new;
+	char *new_msg;
 	size_t i, j;
 	char lastc;
 
-	/* First pass: tally, in j, the size of the new string: */
+	/* First pass: tally, in j, the size of the new_msg string: */
 	for (i = j = 0, lastc = '\0'; i < msg->len; i++) {
 		if (msg->buf[i] == '\n' && lastc != '\r')
 			j++; /* a CR will need to be added here */
@@ -1201,18 +1201,18 @@ static void lf_to_crlf(struct strbuf *msg)
 		j++;
 	}
 
-	new = xmallocz(j);
+	new_msg = xmallocz(j);
 
 	/*
-	 * Second pass: write the new string.  Note that this loop is
+	 * Second pass: write the new_msg string.  Note that this loop is
 	 * otherwise identical to the first pass.
 	 */
 	for (i = j = 0, lastc = '\0'; i < msg->len; i++) {
 		if (msg->buf[i] == '\n' && lastc != '\r')
-			new[j++] = '\r';
-		lastc = new[j++] = msg->buf[i];
+			new_msg[j++] = '\r';
+		lastc = new_msg[j++] = msg->buf[i];
 	}
-	strbuf_attach(msg, new, j, j + 1);
+	strbuf_attach(msg, new_msg, j, j + 1);
 }
 
 /*
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 22/37] line-log: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (20 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 21/37] imap-send: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 23/37] read-cache: " Brandon Williams
                     ` (15 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 line-log.c | 56 +++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/line-log.c b/line-log.c
index 545ad0f28..cdc2257db 100644
--- a/line-log.c
+++ b/line-log.c
@@ -151,29 +151,29 @@ static void range_set_union(struct range_set *out,
 
 	assert(out->nr == 0);
 	while (i < a->nr || j < b->nr) {
-		struct range *new;
+		struct range *new_range;
 		if (i < a->nr && j < b->nr) {
 			if (ra[i].start < rb[j].start)
-				new = &ra[i++];
+				new_range = &ra[i++];
 			else if (ra[i].start > rb[j].start)
-				new = &rb[j++];
+				new_range = &rb[j++];
 			else if (ra[i].end < rb[j].end)
-				new = &ra[i++];
+				new_range = &ra[i++];
 			else
-				new = &rb[j++];
+				new_range = &rb[j++];
 		} else if (i < a->nr)      /* b exhausted */
-			new = &ra[i++];
+			new_range = &ra[i++];
 		else                       /* a exhausted */
-			new = &rb[j++];
-		if (new->start == new->end)
+			new_range = &rb[j++];
+		if (new_range->start == new_range->end)
 			; /* empty range */
-		else if (!out->nr || out->ranges[out->nr-1].end < new->start) {
+		else if (!out->nr || out->ranges[out->nr-1].end < new_range->start) {
 			range_set_grow(out, 1);
-			out->ranges[out->nr].start = new->start;
-			out->ranges[out->nr].end = new->end;
+			out->ranges[out->nr].start = new_range->start;
+			out->ranges[out->nr].end = new_range->end;
 			out->nr++;
-		} else if (out->ranges[out->nr-1].end < new->end) {
-			out->ranges[out->nr-1].end = new->end;
+		} else if (out->ranges[out->nr-1].end < new_range->end) {
+			out->ranges[out->nr-1].end = new_range->end;
 		}
 	}
 }
@@ -696,18 +696,18 @@ static struct line_log_data *line_log_data_merge(struct line_log_data *a,
 static void add_line_range(struct rev_info *revs, struct commit *commit,
 			   struct line_log_data *range)
 {
-	struct line_log_data *old = NULL;
-	struct line_log_data *new = NULL;
+	struct line_log_data *old_line = NULL;
+	struct line_log_data *new_line = NULL;
 
-	old = lookup_decoration(&revs->line_log_data, &commit->object);
-	if (old && range) {
-		new = line_log_data_merge(old, range);
-		free_line_log_data(old);
+	old_line = lookup_decoration(&revs->line_log_data, &commit->object);
+	if (old_line && range) {
+		new_line = line_log_data_merge(old_line, range);
+		free_line_log_data(old_line);
 	} else if (range)
-		new = line_log_data_copy(range);
+		new_line = line_log_data_copy(range);
 
-	if (new)
-		add_decoration(&revs->line_log_data, &commit->object, new);
+	if (new_line)
+		add_decoration(&revs->line_log_data, &commit->object, new_line);
 }
 
 static void clear_commit_line_range(struct rev_info *revs, struct commit *commit)
@@ -1042,12 +1042,12 @@ static int process_diff_filepair(struct rev_info *rev,
 
 static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair)
 {
-	struct diff_filepair *new = xmalloc(sizeof(struct diff_filepair));
-	new->one = pair->one;
-	new->two = pair->two;
-	new->one->count++;
-	new->two->count++;
-	return new;
+	struct diff_filepair *new_filepair = xmalloc(sizeof(struct diff_filepair));
+	new_filepair->one = pair->one;
+	new_filepair->two = pair->two;
+	new_filepair->one->count++;
+	new_filepair->two->count++;
+	return new_filepair;
 }
 
 static void free_diffqueues(int n, struct diff_queue_struct *dq)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 23/37] read-cache: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (21 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 22/37] line-log: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 24/37] ref-filter: " Brandon Williams
                     ` (14 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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

diff --git a/read-cache.c b/read-cache.c
index 2eb81a66b..b22668bfa 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -70,20 +70,20 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
 
 void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
 {
-	struct cache_entry *old = istate->cache[nr], *new;
+	struct cache_entry *old_entry = istate->cache[nr], *new_entry;
 	int namelen = strlen(new_name);
 
-	new = xmalloc(cache_entry_size(namelen));
-	copy_cache_entry(new, old);
-	new->ce_flags &= ~CE_HASHED;
-	new->ce_namelen = namelen;
-	new->index = 0;
-	memcpy(new->name, new_name, namelen + 1);
+	new_entry = xmalloc(cache_entry_size(namelen));
+	copy_cache_entry(new_entry, old_entry);
+	new_entry->ce_flags &= ~CE_HASHED;
+	new_entry->ce_namelen = namelen;
+	new_entry->index = 0;
+	memcpy(new_entry->name, new_name, namelen + 1);
 
-	cache_tree_invalidate_path(istate, old->name);
-	untracked_cache_remove_from_index(istate, old->name);
+	cache_tree_invalidate_path(istate, old_entry->name);
+	untracked_cache_remove_from_index(istate, old_entry->name);
 	remove_index_entry_at(istate, nr);
-	add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+	add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
 }
 
 void fill_stat_data(struct stat_data *sd, struct stat *st)
@@ -615,18 +615,18 @@ static struct cache_entry *create_alias_ce(struct index_state *istate,
 					   struct cache_entry *alias)
 {
 	int len;
-	struct cache_entry *new;
+	struct cache_entry *new_entry;
 
 	if (alias->ce_flags & CE_ADDED)
 		die("Will not add file alias '%s' ('%s' already exists in index)", ce->name, alias->name);
 
 	/* Ok, create the new entry using the name of the existing alias */
 	len = ce_namelen(alias);
-	new = xcalloc(1, cache_entry_size(len));
-	memcpy(new->name, alias->name, len);
-	copy_cache_entry(new, ce);
+	new_entry = xcalloc(1, cache_entry_size(len));
+	memcpy(new_entry->name, alias->name, len);
+	copy_cache_entry(new_entry, ce);
 	save_or_free_index_entry(istate, ce);
-	return new;
+	return new_entry;
 }
 
 void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
@@ -1379,7 +1379,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
 	added_fmt = (in_porcelain ? "A\t%s\n" : "%s needs update\n");
 	unmerged_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
 	for (i = 0; i < istate->cache_nr; i++) {
-		struct cache_entry *ce, *new;
+		struct cache_entry *ce, *new_entry;
 		int cache_errno = 0;
 		int changed = 0;
 		int filtered = 0;
@@ -1408,10 +1408,10 @@ int refresh_index(struct index_state *istate, unsigned int flags,
 		if (filtered)
 			continue;
 
-		new = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);
-		if (new == ce)
+		new_entry = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);
+		if (new_entry == ce)
 			continue;
-		if (!new) {
+		if (!new_entry) {
 			const char *fmt;
 
 			if (really && cache_errno == EINVAL) {
@@ -1440,7 +1440,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
 			continue;
 		}
 
-		replace_index_entry(istate, i, new);
+		replace_index_entry(istate, i, new_entry);
 	}
 	return has_errors;
 }
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 24/37] ref-filter: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (22 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 23/37] read-cache: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 25/37] remote: " Brandon Williams
                     ` (13 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 ref-filter.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ref-filter.c b/ref-filter.c
index 9dae6cfe3..99a45beb1 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -529,12 +529,12 @@ static void end_align_handler(struct ref_formatting_stack **stack)
 
 static void align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
 {
-	struct ref_formatting_stack *new;
+	struct ref_formatting_stack *new_stack;
 
 	push_stack_element(&state->stack);
-	new = state->stack;
-	new->at_end = end_align_handler;
-	new->at_end_data = &atomv->atom->u.align;
+	new_stack = state->stack;
+	new_stack->at_end = end_align_handler;
+	new_stack->at_end_data = &atomv->atom->u.align;
 }
 
 static void if_then_else_handler(struct ref_formatting_stack **stack)
@@ -574,16 +574,16 @@ static void if_then_else_handler(struct ref_formatting_stack **stack)
 
 static void if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
 {
-	struct ref_formatting_stack *new;
+	struct ref_formatting_stack *new_stack;
 	struct if_then_else *if_then_else = xcalloc(sizeof(struct if_then_else), 1);
 
 	if_then_else->str = atomv->atom->u.if_then_else.str;
 	if_then_else->cmp_status = atomv->atom->u.if_then_else.cmp_status;
 
 	push_stack_element(&state->stack);
-	new = state->stack;
-	new->at_end = if_then_else_handler;
-	new->at_end_data = if_then_else;
+	new_stack = state->stack;
+	new_stack->at_end = if_then_else_handler;
+	new_stack->at_end_data = if_then_else;
 }
 
 static int is_empty(const char *s)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 25/37] remote: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (23 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 24/37] ref-filter: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 26/37] split-index: " Brandon Williams
                     ` (12 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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

diff --git a/remote.c b/remote.c
index 4e93753e1..2922dca07 100644
--- a/remote.c
+++ b/remote.c
@@ -1970,33 +1970,33 @@ static void unmark_and_free(struct commit_list *list, unsigned int mark)
 int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
 {
 	struct object *o;
-	struct commit *old, *new;
+	struct commit *old_commit, *new_commit;
 	struct commit_list *list, *used;
 	int found = 0;
 
 	/*
-	 * Both new and old must be commit-ish and new is descendant of
-	 * old.  Otherwise we require --force.
+	 * Both new_commit and old_commit must be commit-ish and new_commit is descendant of
+	 * old_commit.  Otherwise we require --force.
 	 */
 	o = deref_tag(parse_object(old_oid), NULL, 0);
 	if (!o || o->type != OBJ_COMMIT)
 		return 0;
-	old = (struct commit *) o;
+	old_commit = (struct commit *) o;
 
 	o = deref_tag(parse_object(new_oid), NULL, 0);
 	if (!o || o->type != OBJ_COMMIT)
 		return 0;
-	new = (struct commit *) o;
+	new_commit = (struct commit *) o;
 
-	if (parse_commit(new) < 0)
+	if (parse_commit(new_commit) < 0)
 		return 0;
 
 	used = list = NULL;
-	commit_list_insert(new, &list);
+	commit_list_insert(new_commit, &list);
 	while (list) {
-		new = pop_most_recent_commit(&list, TMP_MARK);
-		commit_list_insert(new, &used);
-		if (new == old) {
+		new_commit = pop_most_recent_commit(&list, TMP_MARK);
+		commit_list_insert(new_commit, &used);
+		if (new_commit == old_commit) {
 			found = 1;
 			break;
 		}
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 26/37] split-index: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (24 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 25/37] remote: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 27/37] submodule: " Brandon Williams
                     ` (11 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 split-index.c | 16 ++++++++--------
 split-index.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/split-index.c b/split-index.c
index 83e39ec8d..7be5f748a 100644
--- a/split-index.c
+++ b/split-index.c
@@ -303,17 +303,17 @@ void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce
 }
 
 void replace_index_entry_in_base(struct index_state *istate,
-				 struct cache_entry *old,
-				 struct cache_entry *new)
+				 struct cache_entry *old_entry,
+				 struct cache_entry *new_entry)
 {
-	if (old->index &&
+	if (old_entry->index &&
 	    istate->split_index &&
 	    istate->split_index->base &&
-	    old->index <= istate->split_index->base->cache_nr) {
-		new->index = old->index;
-		if (old != istate->split_index->base->cache[new->index - 1])
-			free(istate->split_index->base->cache[new->index - 1]);
-		istate->split_index->base->cache[new->index - 1] = new;
+	    old_entry->index <= istate->split_index->base->cache_nr) {
+		new_entry->index = old_entry->index;
+		if (old_entry != istate->split_index->base->cache[new_entry->index - 1])
+			free(istate->split_index->base->cache[new_entry->index - 1]);
+		istate->split_index->base->cache[new_entry->index - 1] = new_entry;
 	}
 }
 
diff --git a/split-index.h b/split-index.h
index df91c1bda..43d66826e 100644
--- a/split-index.h
+++ b/split-index.h
@@ -21,7 +21,7 @@ struct split_index *init_split_index(struct index_state *istate);
 void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce);
 void replace_index_entry_in_base(struct index_state *istate,
 				 struct cache_entry *old,
-				 struct cache_entry *new);
+				 struct cache_entry *new_entry);
 int read_link_extension(struct index_state *istate,
 			const void *data, unsigned long sz);
 int write_link_extension(struct strbuf *sb,
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 27/37] submodule: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (25 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 26/37] split-index: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 28/37] trailer: " Brandon Williams
                     ` (10 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 submodule.c | 30 +++++++++++++++---------------
 submodule.h |  2 +-
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/submodule.c b/submodule.c
index cd18400e8..12a2503fd 100644
--- a/submodule.c
+++ b/submodule.c
@@ -590,7 +590,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 		struct object_id *one, struct object_id *two,
 		unsigned dirty_submodule)
 {
-	const struct object_id *old = the_hash_algo->empty_tree, *new = the_hash_algo->empty_tree;
+	const struct object_id *old_oid = the_hash_algo->empty_tree, *new_oid = the_hash_algo->empty_tree;
 	struct commit *left = NULL, *right = NULL;
 	struct commit_list *merge_bases = NULL;
 	struct child_process cp = CHILD_PROCESS_INIT;
@@ -605,9 +605,9 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 		goto done;
 
 	if (left)
-		old = one;
+		old_oid = one;
 	if (right)
-		new = two;
+		new_oid = two;
 
 	cp.git_cmd = 1;
 	cp.dir = path;
@@ -630,7 +630,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 		argv_array_pushf(&cp.args, "--dst-prefix=%s%s/",
 				 o->b_prefix, path);
 	}
-	argv_array_push(&cp.args, oid_to_hex(old));
+	argv_array_push(&cp.args, oid_to_hex(old_oid));
 	/*
 	 * If the submodule has modified content, we will diff against the
 	 * work tree, under the assumption that the user has asked for the
@@ -638,7 +638,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 	 * haven't yet been committed to the submodule yet.
 	 */
 	if (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))
-		argv_array_push(&cp.args, oid_to_hex(new));
+		argv_array_push(&cp.args, oid_to_hex(new_oid));
 
 	prepare_submodule_repo_env(&cp.env_array);
 	if (start_command(&cp))
@@ -1578,8 +1578,8 @@ static void submodule_reset_index(const char *path)
  * pass NULL for old or new respectively.
  */
 int submodule_move_head(const char *path,
-			 const char *old,
-			 const char *new,
+			 const char *old_head,
+			 const char *new_head,
 			 unsigned flags)
 {
 	int ret = 0;
@@ -1600,7 +1600,7 @@ int submodule_move_head(const char *path,
 	else
 		error_code_ptr = NULL;
 
-	if (old && !is_submodule_populated_gently(path, error_code_ptr))
+	if (old_head && !is_submodule_populated_gently(path, error_code_ptr))
 		return 0;
 
 	sub = submodule_from_path(&null_oid, path);
@@ -1608,14 +1608,14 @@ int submodule_move_head(const char *path,
 	if (!sub)
 		die("BUG: could not get submodule information for '%s'", path);
 
-	if (old && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) {
+	if (old_head && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) {
 		/* Check if the submodule has a dirty index. */
 		if (submodule_has_dirty_index(sub))
 			return error(_("submodule '%s' has dirty index"), path);
 	}
 
 	if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
-		if (old) {
+		if (old_head) {
 			if (!submodule_uses_gitfile(path))
 				absorb_git_dir_into_superproject("", path,
 					ABSORB_GITDIR_RECURSE_SUBMODULES);
@@ -1629,7 +1629,7 @@ int submodule_move_head(const char *path,
 			submodule_reset_index(path);
 		}
 
-		if (old && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
+		if (old_head && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
 			char *gitdir = xstrfmt("%s/modules/%s",
 				    get_git_common_dir(), sub->name);
 			connect_work_tree_and_git_dir(path, gitdir);
@@ -1658,9 +1658,9 @@ int submodule_move_head(const char *path,
 		argv_array_push(&cp.args, "-m");
 
 	if (!(flags & SUBMODULE_MOVE_HEAD_FORCE))
-		argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
+		argv_array_push(&cp.args, old_head ? old_head : EMPTY_TREE_SHA1_HEX);
 
-	argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
+	argv_array_push(&cp.args, new_head ? new_head : EMPTY_TREE_SHA1_HEX);
 
 	if (run_command(&cp)) {
 		ret = -1;
@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,
 	}
 
 	if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
-		if (new) {
+		if (new_head) {
 			child_process_init(&cp);
 			/* also set the HEAD accordingly */
 			cp.git_cmd = 1;
@@ -1677,7 +1677,7 @@ int submodule_move_head(const char *path,
 
 			prepare_submodule_repo_env(&cp.env_array);
 			argv_array_pushl(&cp.args, "update-ref", "HEAD",
-					 "--no-deref", new, NULL);
+					 "--no-deref", new_head, NULL);
 
 			if (run_command(&cp)) {
 				ret = -1;
diff --git a/submodule.h b/submodule.h
index b9b7ef003..9589f1312 100644
--- a/submodule.h
+++ b/submodule.h
@@ -117,7 +117,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule);
 #define SUBMODULE_MOVE_HEAD_FORCE   (1<<1)
 extern int submodule_move_head(const char *path,
 			       const char *old,
-			       const char *new,
+			       const char *new_head,
 			       unsigned flags);
 
 /*
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 28/37] trailer: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (26 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 27/37] submodule: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 29/37] unpack-trees: " Brandon Williams
                     ` (9 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 trailer.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/trailer.c b/trailer.c
index 3ba157ed0..5a4a2ecf9 100644
--- a/trailer.c
+++ b/trailer.c
@@ -174,12 +174,12 @@ static void print_all(FILE *outfile, struct list_head *head,
 
 static struct trailer_item *trailer_from_arg(struct arg_item *arg_tok)
 {
-	struct trailer_item *new = xcalloc(sizeof(*new), 1);
-	new->token = arg_tok->token;
-	new->value = arg_tok->value;
+	struct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);
+	new_item->token = arg_tok->token;
+	new_item->value = arg_tok->value;
 	arg_tok->token = arg_tok->value = NULL;
 	free_arg_item(arg_tok);
-	return new;
+	return new_item;
 }
 
 static void add_arg_to_input_list(struct trailer_item *on_tok,
@@ -666,30 +666,30 @@ static void parse_trailer(struct strbuf *tok, struct strbuf *val,
 static struct trailer_item *add_trailer_item(struct list_head *head, char *tok,
 					     char *val)
 {
-	struct trailer_item *new = xcalloc(sizeof(*new), 1);
-	new->token = tok;
-	new->value = val;
-	list_add_tail(&new->list, head);
-	return new;
+	struct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);
+	new_item->token = tok;
+	new_item->value = val;
+	list_add_tail(&new_item->list, head);
+	return new_item;
 }
 
 static void add_arg_item(struct list_head *arg_head, char *tok, char *val,
 			 const struct conf_info *conf,
 			 const struct new_trailer_item *new_trailer_item)
 {
-	struct arg_item *new = xcalloc(sizeof(*new), 1);
-	new->token = tok;
-	new->value = val;
-	duplicate_conf(&new->conf, conf);
+	struct arg_item *new_item = xcalloc(sizeof(*new_item), 1);
+	new_item->token = tok;
+	new_item->value = val;
+	duplicate_conf(&new_item->conf, conf);
 	if (new_trailer_item) {
 		if (new_trailer_item->where != WHERE_DEFAULT)
-			new->conf.where = new_trailer_item->where;
+			new_item->conf.where = new_trailer_item->where;
 		if (new_trailer_item->if_exists != EXISTS_DEFAULT)
-			new->conf.if_exists = new_trailer_item->if_exists;
+			new_item->conf.if_exists = new_trailer_item->if_exists;
 		if (new_trailer_item->if_missing != MISSING_DEFAULT)
-			new->conf.if_missing = new_trailer_item->if_missing;
+			new_item->conf.if_missing = new_trailer_item->if_missing;
 	}
-	list_add_tail(&new->list, arg_head);
+	list_add_tail(&new_item->list, arg_head);
 }
 
 static void process_command_line_args(struct list_head *arg_head,
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 29/37] unpack-trees: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (27 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 28/37] trailer: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 30/37] init-db: rename 'template' variables Brandon Williams
                     ` (8 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 unpack-trees.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index 96c3327f1..bdedabcd5 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -194,10 +194,10 @@ static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
 static struct cache_entry *dup_entry(const struct cache_entry *ce)
 {
 	unsigned int size = ce_size(ce);
-	struct cache_entry *new = xmalloc(size);
+	struct cache_entry *new_entry = xmalloc(size);
 
-	memcpy(new, ce, size);
-	return new;
+	memcpy(new_entry, ce, size);
+	return new_entry;
 }
 
 static void add_entry(struct unpack_trees_options *o,
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 30/37] init-db: rename 'template' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (28 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 29/37] unpack-trees: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 31/37] environment: " Brandon Williams
                     ` (7 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/init-db.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index c9b7946ba..68ff4ad75 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -24,11 +24,11 @@ static int init_is_bare_repository = 0;
 static int init_shared_repository = -1;
 static const char *init_db_template_dir;
 
-static void copy_templates_1(struct strbuf *path, struct strbuf *template,
+static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
 			     DIR *dir)
 {
 	size_t path_baselen = path->len;
-	size_t template_baselen = template->len;
+	size_t template_baselen = template_path->len;
 	struct dirent *de;
 
 	/* Note: if ".git/hooks" file exists in the repository being
@@ -44,12 +44,12 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,
 		int exists = 0;
 
 		strbuf_setlen(path, path_baselen);
-		strbuf_setlen(template, template_baselen);
+		strbuf_setlen(template_path, template_baselen);
 
 		if (de->d_name[0] == '.')
 			continue;
 		strbuf_addstr(path, de->d_name);
-		strbuf_addstr(template, de->d_name);
+		strbuf_addstr(template_path, de->d_name);
 		if (lstat(path->buf, &st_git)) {
 			if (errno != ENOENT)
 				die_errno(_("cannot stat '%s'"), path->buf);
@@ -57,36 +57,36 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,
 		else
 			exists = 1;
 
-		if (lstat(template->buf, &st_template))
-			die_errno(_("cannot stat template '%s'"), template->buf);
+		if (lstat(template_path->buf, &st_template))
+			die_errno(_("cannot stat template '%s'"), template_path->buf);
 
 		if (S_ISDIR(st_template.st_mode)) {
-			DIR *subdir = opendir(template->buf);
+			DIR *subdir = opendir(template_path->buf);
 			if (!subdir)
-				die_errno(_("cannot opendir '%s'"), template->buf);
+				die_errno(_("cannot opendir '%s'"), template_path->buf);
 			strbuf_addch(path, '/');
-			strbuf_addch(template, '/');
-			copy_templates_1(path, template, subdir);
+			strbuf_addch(template_path, '/');
+			copy_templates_1(path, template_path, subdir);
 			closedir(subdir);
 		}
 		else if (exists)
 			continue;
 		else if (S_ISLNK(st_template.st_mode)) {
 			struct strbuf lnk = STRBUF_INIT;
-			if (strbuf_readlink(&lnk, template->buf, 0) < 0)
-				die_errno(_("cannot readlink '%s'"), template->buf);
+			if (strbuf_readlink(&lnk, template_path->buf, 0) < 0)
+				die_errno(_("cannot readlink '%s'"), template_path->buf);
 			if (symlink(lnk.buf, path->buf))
 				die_errno(_("cannot symlink '%s' '%s'"),
 					  lnk.buf, path->buf);
 			strbuf_release(&lnk);
 		}
 		else if (S_ISREG(st_template.st_mode)) {
-			if (copy_file(path->buf, template->buf, st_template.st_mode))
+			if (copy_file(path->buf, template_path->buf, st_template.st_mode))
 				die_errno(_("cannot copy '%s' to '%s'"),
-					  template->buf, path->buf);
+					  template_path->buf, path->buf);
 		}
 		else
-			error(_("ignoring template %s"), template->buf);
+			error(_("ignoring template %s"), template_path->buf);
 	}
 }
 
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 31/37] environment: rename 'template' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (29 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 30/37] init-db: rename 'template' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 32/37] diff: " Brandon Williams
                     ` (6 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 cache.h       |  2 +-
 environment.c | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cache.h b/cache.h
index 69b5a3bf8..5b8d49377 100644
--- a/cache.h
+++ b/cache.h
@@ -1673,7 +1673,7 @@ struct pack_entry {
  * usual "XXXXXX" trailer, and the resulting filename is written into the
  * "template" buffer. Returns the open descriptor.
  */
-extern int odb_mkstemp(struct strbuf *template, const char *pattern);
+extern int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);
 
 /*
  * Create a pack .keep file named "name" (which should generally be the output
diff --git a/environment.c b/environment.c
index 63ac38a46..98f77ea95 100644
--- a/environment.c
+++ b/environment.c
@@ -247,7 +247,7 @@ char *get_object_directory(void)
 	return the_repository->objectdir;
 }
 
-int odb_mkstemp(struct strbuf *template, const char *pattern)
+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)
 {
 	int fd;
 	/*
@@ -255,16 +255,16 @@ int odb_mkstemp(struct strbuf *template, const char *pattern)
 	 * restrictive except to remove write permission.
 	 */
 	int mode = 0444;
-	git_path_buf(template, "objects/%s", pattern);
-	fd = git_mkstemp_mode(template->buf, mode);
+	git_path_buf(temp_filename, "objects/%s", pattern);
+	fd = git_mkstemp_mode(temp_filename->buf, mode);
 	if (0 <= fd)
 		return fd;
 
 	/* slow path */
-	/* some mkstemp implementations erase template on failure */
-	git_path_buf(template, "objects/%s", pattern);
-	safe_create_leading_directories(template->buf);
-	return xmkstemp_mode(template->buf, mode);
+	/* some mkstemp implementations erase temp_filename on failure */
+	git_path_buf(temp_filename, "objects/%s", pattern);
+	safe_create_leading_directories(temp_filename->buf);
+	return xmkstemp_mode(temp_filename->buf, mode);
 }
 
 int odb_pack_keep(const char *name)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 32/37] diff: rename 'template' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (30 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 31/37] environment: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 33/37] environment: rename 'namespace' variables Brandon Williams
                     ` (5 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 diff.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/diff.c b/diff.c
index 2de9c5ed2..5e46502cd 100644
--- a/diff.c
+++ b/diff.c
@@ -3660,15 +3660,15 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
 			   int mode)
 {
 	struct strbuf buf = STRBUF_INIT;
-	struct strbuf template = STRBUF_INIT;
+	struct strbuf tempfile = STRBUF_INIT;
 	char *path_dup = xstrdup(path);
 	const char *base = basename(path_dup);
 
 	/* Generate "XXXXXX_basename.ext" */
-	strbuf_addstr(&template, "XXXXXX_");
-	strbuf_addstr(&template, base);
+	strbuf_addstr(&tempfile, "XXXXXX_");
+	strbuf_addstr(&tempfile, base);
 
-	temp->tempfile = mks_tempfile_ts(template.buf, strlen(base) + 1);
+	temp->tempfile = mks_tempfile_ts(tempfile.buf, strlen(base) + 1);
 	if (!temp->tempfile)
 		die_errno("unable to create temp-file");
 	if (convert_to_working_tree(path,
@@ -3683,7 +3683,7 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
 	oid_to_hex_r(temp->hex, oid);
 	xsnprintf(temp->mode, sizeof(temp->mode), "%06o", mode);
 	strbuf_release(&buf);
-	strbuf_release(&template);
+	strbuf_release(&tempfile);
 	free(path_dup);
 }
 
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 33/37] environment: rename 'namespace' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (31 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 32/37] diff: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 34/37] wrapper: rename 'template' variables Brandon Williams
                     ` (4 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 environment.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/environment.c b/environment.c
index 98f77ea95..270ba98b5 100644
--- a/environment.c
+++ b/environment.c
@@ -98,7 +98,7 @@ int ignore_untracked_cache_config;
 /* This is set by setup_git_dir_gently() and/or git_default_config() */
 char *git_work_tree_cfg;
 
-static char *namespace;
+static char *git_namespace;
 
 static const char *super_prefix;
 
@@ -156,8 +156,8 @@ void setup_git_env(void)
 	free(git_replace_ref_base);
 	git_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base
 							  : "refs/replace/");
-	free(namespace);
-	namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
+	free(git_namespace);
+	git_namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
 	shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);
 	if (shallow_file)
 		set_alternate_shallow_file(shallow_file, 0);
@@ -191,9 +191,9 @@ const char *get_git_common_dir(void)
 
 const char *get_git_namespace(void)
 {
-	if (!namespace)
+	if (!git_namespace)
 		BUG("git environment hasn't been setup");
-	return namespace;
+	return git_namespace;
 }
 
 const char *strip_namespace(const char *namespaced_ref)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 34/37] wrapper: rename 'template' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (32 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 33/37] environment: rename 'namespace' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 35/37] tempfile: " Brandon Williams
                     ` (3 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 git-compat-util.h |  4 ++--
 wrapper.c         | 40 ++++++++++++++++++++--------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 68b2ad531..07e383257 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -826,8 +826,8 @@ extern ssize_t xpread(int fd, void *buf, size_t len, off_t offset);
 extern int xdup(int fd);
 extern FILE *xfopen(const char *path, const char *mode);
 extern FILE *xfdopen(int fd, const char *mode);
-extern int xmkstemp(char *template);
-extern int xmkstemp_mode(char *template, int mode);
+extern int xmkstemp(char *temp_filename);
+extern int xmkstemp_mode(char *temp_filename, int mode);
 extern char *xgetcwd(void);
 extern FILE *fopen_for_writing(const char *path);
 extern FILE *fopen_or_warn(const char *path, const char *mode);
diff --git a/wrapper.c b/wrapper.c
index d20356a77..1fd5e33ea 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -445,21 +445,21 @@ FILE *fopen_or_warn(const char *path, const char *mode)
 	return NULL;
 }
 
-int xmkstemp(char *template)
+int xmkstemp(char *filename_template)
 {
 	int fd;
 	char origtemplate[PATH_MAX];
-	strlcpy(origtemplate, template, sizeof(origtemplate));
+	strlcpy(origtemplate, filename_template, sizeof(origtemplate));
 
-	fd = mkstemp(template);
+	fd = mkstemp(filename_template);
 	if (fd < 0) {
 		int saved_errno = errno;
 		const char *nonrelative_template;
 
-		if (strlen(template) != strlen(origtemplate))
-			template = origtemplate;
+		if (strlen(filename_template) != strlen(origtemplate))
+			filename_template = origtemplate;
 
-		nonrelative_template = absolute_path(template);
+		nonrelative_template = absolute_path(filename_template);
 		errno = saved_errno;
 		die_errno("Unable to create temporary file '%s'",
 			nonrelative_template);
@@ -481,7 +481,7 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
 	static const int num_letters = 62;
 	uint64_t value;
 	struct timeval tv;
-	char *template;
+	char *filename_template;
 	size_t len;
 	int fd, count;
 
@@ -503,16 +503,16 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
 	 */
 	gettimeofday(&tv, NULL);
 	value = ((size_t)(tv.tv_usec << 16)) ^ tv.tv_sec ^ getpid();
-	template = &pattern[len - 6 - suffix_len];
+	filename_template = &pattern[len - 6 - suffix_len];
 	for (count = 0; count < TMP_MAX; ++count) {
 		uint64_t v = value;
 		/* Fill in the random bits. */
-		template[0] = letters[v % num_letters]; v /= num_letters;
-		template[1] = letters[v % num_letters]; v /= num_letters;
-		template[2] = letters[v % num_letters]; v /= num_letters;
-		template[3] = letters[v % num_letters]; v /= num_letters;
-		template[4] = letters[v % num_letters]; v /= num_letters;
-		template[5] = letters[v % num_letters]; v /= num_letters;
+		filename_template[0] = letters[v % num_letters]; v /= num_letters;
+		filename_template[1] = letters[v % num_letters]; v /= num_letters;
+		filename_template[2] = letters[v % num_letters]; v /= num_letters;
+		filename_template[3] = letters[v % num_letters]; v /= num_letters;
+		filename_template[4] = letters[v % num_letters]; v /= num_letters;
+		filename_template[5] = letters[v % num_letters]; v /= num_letters;
 
 		fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);
 		if (fd >= 0)
@@ -541,21 +541,21 @@ int git_mkstemp_mode(char *pattern, int mode)
 	return git_mkstemps_mode(pattern, 0, mode);
 }
 
-int xmkstemp_mode(char *template, int mode)
+int xmkstemp_mode(char *filename_template, int mode)
 {
 	int fd;
 	char origtemplate[PATH_MAX];
-	strlcpy(origtemplate, template, sizeof(origtemplate));
+	strlcpy(origtemplate, filename_template, sizeof(origtemplate));
 
-	fd = git_mkstemp_mode(template, mode);
+	fd = git_mkstemp_mode(filename_template, mode);
 	if (fd < 0) {
 		int saved_errno = errno;
 		const char *nonrelative_template;
 
-		if (!template[0])
-			template = origtemplate;
+		if (!filename_template[0])
+			filename_template = origtemplate;
 
-		nonrelative_template = absolute_path(template);
+		nonrelative_template = absolute_path(filename_template);
 		errno = saved_errno;
 		die_errno("Unable to create temporary file '%s'",
 			nonrelative_template);
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 35/37] tempfile: rename 'template' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (33 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 34/37] wrapper: rename 'template' variables Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 18:59   ` [PATCH v2 36/37] trailer: " Brandon Williams
                     ` (2 subsequent siblings)
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 tempfile.c | 12 ++++++------
 tempfile.h | 34 +++++++++++++++++-----------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/tempfile.c b/tempfile.c
index 5fdafdd2d..139ecd97f 100644
--- a/tempfile.c
+++ b/tempfile.c
@@ -165,11 +165,11 @@ struct tempfile *register_tempfile(const char *path)
 	return tempfile;
 }
 
-struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)
+struct tempfile *mks_tempfile_sm(const char *filename_template, int suffixlen, int mode)
 {
 	struct tempfile *tempfile = new_tempfile();
 
-	strbuf_add_absolute_path(&tempfile->filename, template);
+	strbuf_add_absolute_path(&tempfile->filename, filename_template);
 	tempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);
 	if (tempfile->fd < 0) {
 		deactivate_tempfile(tempfile);
@@ -179,7 +179,7 @@ struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)
 	return tempfile;
 }
 
-struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)
+struct tempfile *mks_tempfile_tsm(const char *filename_template, int suffixlen, int mode)
 {
 	struct tempfile *tempfile = new_tempfile();
 	const char *tmpdir;
@@ -188,7 +188,7 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)
 	if (!tmpdir)
 		tmpdir = "/tmp";
 
-	strbuf_addf(&tempfile->filename, "%s/%s", tmpdir, template);
+	strbuf_addf(&tempfile->filename, "%s/%s", tmpdir, filename_template);
 	tempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);
 	if (tempfile->fd < 0) {
 		deactivate_tempfile(tempfile);
@@ -198,12 +198,12 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)
 	return tempfile;
 }
 
-struct tempfile *xmks_tempfile_m(const char *template, int mode)
+struct tempfile *xmks_tempfile_m(const char *filename_template, int mode)
 {
 	struct tempfile *tempfile;
 	struct strbuf full_template = STRBUF_INIT;
 
-	strbuf_add_absolute_path(&full_template, template);
+	strbuf_add_absolute_path(&full_template, filename_template);
 	tempfile = mks_tempfile_m(full_template.buf, mode);
 	if (!tempfile)
 		die_errno("Unable to create temporary file '%s'",
diff --git a/tempfile.h b/tempfile.h
index 450908b2e..8959c5f1b 100644
--- a/tempfile.h
+++ b/tempfile.h
@@ -135,58 +135,58 @@ extern struct tempfile *register_tempfile(const char *path);
  */
 
 /* See "mks_tempfile functions" above. */
-extern struct tempfile *mks_tempfile_sm(const char *template,
+extern struct tempfile *mks_tempfile_sm(const char *filename_template,
 					int suffixlen, int mode);
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_s(const char *template,
+static inline struct tempfile *mks_tempfile_s(const char *filename_template,
 					      int suffixlen)
 {
-	return mks_tempfile_sm(template, suffixlen, 0600);
+	return mks_tempfile_sm(filename_template, suffixlen, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_m(const char *template, int mode)
+static inline struct tempfile *mks_tempfile_m(const char *filename_template, int mode)
 {
-	return mks_tempfile_sm(template, 0, mode);
+	return mks_tempfile_sm(filename_template, 0, mode);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile(const char *template)
+static inline struct tempfile *mks_tempfile(const char *filename_template)
 {
-	return mks_tempfile_sm(template, 0, 0600);
+	return mks_tempfile_sm(filename_template, 0, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-extern struct tempfile *mks_tempfile_tsm(const char *template,
+extern struct tempfile *mks_tempfile_tsm(const char *filename_template,
 					 int suffixlen, int mode);
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_ts(const char *template,
+static inline struct tempfile *mks_tempfile_ts(const char *filename_template,
 					       int suffixlen)
 {
-	return mks_tempfile_tsm(template, suffixlen, 0600);
+	return mks_tempfile_tsm(filename_template, suffixlen, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_tm(const char *template, int mode)
+static inline struct tempfile *mks_tempfile_tm(const char *filename_template, int mode)
 {
-	return mks_tempfile_tsm(template, 0, mode);
+	return mks_tempfile_tsm(filename_template, 0, mode);
 }
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *mks_tempfile_t(const char *template)
+static inline struct tempfile *mks_tempfile_t(const char *filename_template)
 {
-	return mks_tempfile_tsm(template, 0, 0600);
+	return mks_tempfile_tsm(filename_template, 0, 0600);
 }
 
 /* See "mks_tempfile functions" above. */
-extern struct tempfile *xmks_tempfile_m(const char *template, int mode);
+extern struct tempfile *xmks_tempfile_m(const char *filename_template, int mode);
 
 /* See "mks_tempfile functions" above. */
-static inline struct tempfile *xmks_tempfile(const char *template)
+static inline struct tempfile *xmks_tempfile(const char *filename_template)
 {
-	return xmks_tempfile_m(template, 0600);
+	return xmks_tempfile_m(filename_template, 0600);
 }
 
 /*
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 36/37] trailer: rename 'template' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (34 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 35/37] tempfile: " Brandon Williams
@ 2018-02-14 18:59   ` 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
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 trailer.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/trailer.c b/trailer.c
index 5a4a2ecf9..c508c9b75 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1000,7 +1000,7 @@ static struct tempfile *trailers_tempfile;
 static FILE *create_in_place_tempfile(const char *file)
 {
 	struct stat st;
-	struct strbuf template = STRBUF_INIT;
+	struct strbuf filename_template = STRBUF_INIT;
 	const char *tail;
 	FILE *outfile;
 
@@ -1014,11 +1014,11 @@ static FILE *create_in_place_tempfile(const char *file)
 	/* Create temporary file in the same directory as the original */
 	tail = strrchr(file, '/');
 	if (tail != NULL)
-		strbuf_add(&template, file, tail - file + 1);
-	strbuf_addstr(&template, "git-interpret-trailers-XXXXXX");
+		strbuf_add(&filename_template, file, tail - file + 1);
+	strbuf_addstr(&filename_template, "git-interpret-trailers-XXXXXX");
 
-	trailers_tempfile = xmks_tempfile_m(template.buf, st.st_mode);
-	strbuf_release(&template);
+	trailers_tempfile = xmks_tempfile_m(filename_template.buf, st.st_mode);
+	strbuf_release(&filename_template);
 	outfile = fdopen_tempfile(trailers_tempfile, "w");
 	if (!outfile)
 		die_errno(_("could not open temporary file"));
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* [PATCH v2 37/37] replace: rename 'new' variables
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (35 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 36/37] trailer: " Brandon Williams
@ 2018-02-14 18:59   ` Brandon Williams
  2018-02-14 22:41   ` [PATCH v2 00/37] removal of some c++ keywords Stefan Beller
  37 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 18:59 UTC (permalink / raw)
  To: git; +Cc: j6t, sbeller, avarab, pclouds, Brandon Williams

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>
---
 builtin/replace.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/builtin/replace.c b/builtin/replace.c
index 42cf4f62a..303ca134d 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -284,30 +284,30 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
 {
 	char *tmpfile = git_pathdup("REPLACE_EDITOBJ");
 	enum object_type type;
-	struct object_id old, new, prev;
+	struct object_id old_oid, new_oid, prev;
 	struct strbuf ref = STRBUF_INIT;
 
-	if (get_oid(object_ref, &old) < 0)
+	if (get_oid(object_ref, &old_oid) < 0)
 		die("Not a valid object name: '%s'", object_ref);
 
-	type = sha1_object_info(old.hash, NULL);
+	type = sha1_object_info(old_oid.hash, NULL);
 	if (type < 0)
-		die("unable to get object type for %s", oid_to_hex(&old));
+		die("unable to get object type for %s", oid_to_hex(&old_oid));
 
-	check_ref_valid(&old, &prev, &ref, force);
+	check_ref_valid(&old_oid, &prev, &ref, force);
 	strbuf_release(&ref);
 
-	export_object(&old, type, raw, tmpfile);
+	export_object(&old_oid, type, raw, tmpfile);
 	if (launch_editor(tmpfile, NULL, NULL) < 0)
 		die("editing object file failed");
-	import_object(&new, type, raw, tmpfile);
+	import_object(&new_oid, type, raw, tmpfile);
 
 	free(tmpfile);
 
-	if (!oidcmp(&old, &new))
-		return error("new object is the same as the old one: '%s'", oid_to_hex(&old));
+	if (!oidcmp(&old_oid, &new_oid))
+		return error("new object is the same as the old one: '%s'", oid_to_hex(&old_oid));
 
-	return replace_object_oid(object_ref, &old, "replacement", &new, force);
+	return replace_object_oid(object_ref, &old_oid, "replacement", &new_oid, force);
 }
 
 static void replace_parents(struct strbuf *buf, int argc, const char **argv)
@@ -386,16 +386,16 @@ static void check_mergetags(struct commit *commit, int argc, const char **argv)
 
 static int create_graft(int argc, const char **argv, int force)
 {
-	struct object_id old, new;
+	struct object_id old_oid, new_oid;
 	const char *old_ref = argv[0];
 	struct commit *commit;
 	struct strbuf buf = STRBUF_INIT;
 	const char *buffer;
 	unsigned long size;
 
-	if (get_oid(old_ref, &old) < 0)
+	if (get_oid(old_ref, &old_oid) < 0)
 		die(_("Not a valid object name: '%s'"), old_ref);
-	commit = lookup_commit_or_die(&old, old_ref);
+	commit = lookup_commit_or_die(&old_oid, old_ref);
 
 	buffer = get_commit_buffer(commit, &size);
 	strbuf_add(&buf, buffer, size);
@@ -410,15 +410,15 @@ static int create_graft(int argc, const char **argv, int force)
 
 	check_mergetags(commit, argc, argv);
 
-	if (write_sha1_file(buf.buf, buf.len, commit_type, new.hash))
+	if (write_sha1_file(buf.buf, buf.len, commit_type, new_oid.hash))
 		die(_("could not write replacement commit for: '%s'"), old_ref);
 
 	strbuf_release(&buf);
 
-	if (!oidcmp(&old, &new))
-		return error("new commit is the same as the old one: '%s'", oid_to_hex(&old));
+	if (!oidcmp(&old_oid, &new_oid))
+		return error("new commit is the same as the old one: '%s'", oid_to_hex(&old_oid));
 
-	return replace_object_oid(old_ref, &old, "replacement", &new, force);
+	return replace_object_oid(old_ref, &old_oid, "replacement", &new_oid, force);
 }
 
 int cmd_replace(int argc, const char **argv, const char *prefix)
-- 
2.16.1.291.g4437f3f132-goog


^ permalink raw reply related	[flat|nested] 89+ messages in thread

* Re: [PATCH v2 06/37] diff: rename 'this' variables
  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
  0 siblings, 1 reply; 89+ messages in thread
From: Junio C Hamano @ 2018-02-14 21:19 UTC (permalink / raw)
  To: Brandon Williams; +Cc: git, j6t, sbeller, avarab, pclouds

Brandon Williams <bmwill@google.com> writes:

> 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>
> ---

The patch is not as bad as renaming "this" and leaving "that" behind
but in the original, "this" and "this_dir" were treated as a pair.
"this" was a score for a single item in the directory, "this_dir"
was the sum of these scores for entries in the directory.

So renaming "this" to "sum" and leaving "this_dir" as-is looks like
readability regression.  Perhaps replace "this_dir" with "sum_changes"
and "this" with "changes" instead, or something like that?

>  diff.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index 0a9a0cdf1..d682d0d1f 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
>  	while (dir->nr) {
>  		struct dirstat_file *f = dir->files;
>  		int namelen = strlen(f->name);
> -		unsigned long this;
> +		unsigned long sum;
>  		char *slash;
>  
>  		if (namelen < baselen)
> @@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
>  		slash = strchr(f->name + baselen, '/');
>  		if (slash) {
>  			int newbaselen = slash + 1 - f->name;
> -			this = gather_dirstat(opt, dir, changed, f->name, newbaselen);
> +			sum = gather_dirstat(opt, dir, changed, f->name, newbaselen);
>  			sources++;
>  		} else {
> -			this = f->changed;
> +			sum = f->changed;
>  			dir->files++;
>  			dir->nr--;
>  			sources += 2;
>  		}
> -		this_dir += this;
> +		this_dir += sum;
>  	}
>  
>  	/*

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH v2 06/37] diff: rename 'this' variables
  2018-02-14 21:19     ` Junio C Hamano
@ 2018-02-14 21:24       ` Brandon Williams
  0 siblings, 0 replies; 89+ messages in thread
From: Brandon Williams @ 2018-02-14 21:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, j6t, sbeller, avarab, pclouds

On 02/14, Junio C Hamano wrote:
> Brandon Williams <bmwill@google.com> writes:
> 
> > 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>
> > ---
> 
> The patch is not as bad as renaming "this" and leaving "that" behind
> but in the original, "this" and "this_dir" were treated as a pair.
> "this" was a score for a single item in the directory, "this_dir"
> was the sum of these scores for entries in the directory.
> 
> So renaming "this" to "sum" and leaving "this_dir" as-is looks like
> readability regression.  Perhaps replace "this_dir" with "sum_changes"
> and "this" with "changes" instead, or something like that?

100% agree.  I tried to spend time on each of these changes to come up
with a meaningful name, but sometimes wasn't able to understand the
section of code (with the limited context I had with some areas) and
wasn't able to come up with the best name.  I'll change this.

> 
> >  diff.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/diff.c b/diff.c
> > index 0a9a0cdf1..d682d0d1f 100644
> > --- a/diff.c
> > +++ b/diff.c
> > @@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
> >  	while (dir->nr) {
> >  		struct dirstat_file *f = dir->files;
> >  		int namelen = strlen(f->name);
> > -		unsigned long this;
> > +		unsigned long sum;
> >  		char *slash;
> >  
> >  		if (namelen < baselen)
> > @@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,
> >  		slash = strchr(f->name + baselen, '/');
> >  		if (slash) {
> >  			int newbaselen = slash + 1 - f->name;
> > -			this = gather_dirstat(opt, dir, changed, f->name, newbaselen);
> > +			sum = gather_dirstat(opt, dir, changed, f->name, newbaselen);
> >  			sources++;
> >  		} else {
> > -			this = f->changed;
> > +			sum = f->changed;
> >  			dir->files++;
> >  			dir->nr--;
> >  			sources += 2;
> >  		}
> > -		this_dir += this;
> > +		this_dir += sum;
> >  	}
> >  
> >  	/*

-- 
Brandon Williams

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH v2 08/37] apply: rename 'new' variables
  2018-02-14 18:59   ` [PATCH v2 08/37] apply: rename 'new' variables Brandon Williams
@ 2018-02-14 21:40     ` Stefan Beller
  0 siblings, 0 replies; 89+ messages in thread
From: Stefan Beller @ 2018-02-14 21:40 UTC (permalink / raw)
  To: Brandon Williams
  Cc: git, Johannes Sixt, Ævar Arnfjörð Bjarmason,
	Duy Nguyen

On Wed, Feb 14, 2018 at 10:59 AM, Brandon Williams <bmwill@google.com> wrote:
> 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>
> ---
>  apply.c | 54 +++++++++++++++++++++++++++---------------------------
>  1 file changed, 27 insertions(+), 27 deletions(-)
>
> diff --git a/apply.c b/apply.c
> index 071f653c6..e9f34dceb 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,
>                                    size_t len, size_t postlen)
>  {
>         int i, ctx, reduced;
> -       char *new, *old, *fixed;
> +       char *new_buf, *old_buf, *fixed;

*_buf makes it sound like it could be a strbuf at first,
but it is just a buffer. That is ok, as we take over a buffer from
'postimage->buf'. I was suggesting a new name, but given that
reuse of "buf", I guess this is fine.

^ permalink raw reply	[flat|nested] 89+ messages in thread

* Re: [PATCH v2 00/37] removal of some c++ keywords
  2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
                     ` (36 preceding siblings ...)
  2018-02-14 18:59   ` [PATCH v2 37/37] replace: rename 'new' variables Brandon Williams
@ 2018-02-14 22:41   ` Stefan Beller
  37 siblings, 0 replies; 89+ messages in thread
From: Stefan Beller @ 2018-02-14 22:41 UTC (permalink / raw)
  To: Brandon Williams
  Cc: git, Johannes Sixt, Ævar Arnfjörð Bjarmason,
	Duy Nguyen

On Wed, Feb 14, 2018 at 10:59 AM, Brandon Williams <bmwill@google.com> wrote:
> One person was interested enough for me to go back through and also
> rename all the paired 'old' variables to match the new names for the
> variables which were named 'new'.

The patches are:
Reviewed-by: Stefan Beller <sbeller@google.com>
(apart from the 'this' nit Junio had)

^ permalink raw reply	[flat|nested] 89+ messages in thread

end of thread, other threads:[~2018-02-14 22:41 UTC | newest]

Thread overview: 89+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 19/37] entry: " Brandon Williams
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).