{"thread":{"id":"47717","subject":"[PATCH 00/37] removal of some c++ keywords","startedAt":"2018-01-29T22:37:46Z","lastAt":"2018-02-14T22:41:22Z","messageCount":89,"participants":["Brandon Williams","Duy Nguyen","Johannes Sixt","Junio C Hamano","Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":37},"messages":[{"id":"337711","messageId":"20180129223728.30569-1-bmwill@google.com","threadId":"47717","inReplyTo":null,"subject":"[PATCH 00/37] removal of some c++ keywords","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:51Z","receivedAt":"2018-01-29T22:37:46Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"A while back there was some discussion of getting our codebase into a state\nwhere we could use a c++ compiler if we wanted to (for various reason like\nleveraging c++ only analysis tools, etc.).  Johannes Sixt had a very large\npatch that achieved this but it wasn't in a state where it could be upstreamed.\nI took that idea and did some removals of c++ keywords (new, template, try,\nthis, etc) but broke it up into several (well maybe more than several) patches.\nI don't believe I've captured all of them in this series but this is at least\nmoving a step closer to being able to compile using a c++ compiler.\n\nI don't know if this is something the community still wants to move towards,\nbut if this is something people are still interested in, and this series is\nwanted, then we can keep doing these sort of conversions in chunks slowly.\n\nBrandon Williams (37):\n  object_info: change member name from 'typename' to 'type_name'\n  object: rename function 'typename' to 'type_name'\n  blame: rename 'this' variables\n  pack-objects: rename 'this' variables\n  rev-parse: rename 'this' variable\n  diff: rename 'this' variables\n  apply: rename 'try' variables\n  apply: rename 'new' variables\n  checkout: rename 'new' variables\n  help: rename 'new' variables\n  pack-redundant: rename 'new' variables\n  reflog: rename 'new' variables\n  remote: rename 'new' variables\n  combine-diff: rename 'new' variables\n  commit: rename 'new' variables\n  diff-lib: rename 'new' variable\n  diff: rename 'new' variables\n  diffcore-delta: rename 'new' variables\n  entry: rename 'new' variables\n  http: rename 'new' variables\n  imap-send: rename 'new' variables\n  line-log: rename 'new' variables\n  read-cache: rename 'new' variables\n  ref-filter: rename 'new' variables\n  remote: rename 'new' variables\n  split-index: rename 'new' variables\n  submodule: rename 'new' variables\n  trailer: rename 'new' variables\n  unpack-trees: rename 'new' variables\n  init-db: rename 'template' variables\n  environment: rename 'template' variables\n  diff: rename 'template' variables\n  environment: rename 'namespace' variables\n  wrapper: rename 'template' variables\n  tempfile: rename 'template' variables\n  trailer: rename 'template' variables\n  replace: rename 'new' variables\n\n apply.c                                | 106 ++++++++++++-------------\n blame.c                                |  33 ++++----\n builtin/cat-file.c                     |   4 +-\n builtin/checkout.c                     | 138 ++++++++++++++++-----------------\n builtin/diff-tree.c                    |   2 +-\n builtin/fast-export.c                  |   8 +-\n builtin/fsck.c                         |   4 +-\n builtin/grep.c                         |   2 +-\n builtin/help.c                         |  10 +--\n builtin/index-pack.c                   |  12 +--\n builtin/init-db.c                      |  30 +++----\n builtin/merge.c                        |   2 +-\n builtin/mktree.c                       |   4 +-\n builtin/pack-objects.c                 |   8 +-\n builtin/pack-redundant.c               |  48 ++++++------\n builtin/prune.c                        |   2 +-\n builtin/reflog.c                       |   8 +-\n builtin/remote.c                       |  44 +++++------\n builtin/replace.c                      |  28 +++----\n builtin/rev-parse.c                    |  34 ++++----\n builtin/tag.c                          |   2 +-\n builtin/unpack-objects.c               |  10 +--\n builtin/verify-commit.c                |   2 +-\n bulk-checkin.c                         |   2 +-\n cache.h                                |   4 +-\n combine-diff.c                         |  12 +--\n commit.c                               |  20 ++---\n contrib/examples/builtin-fetch--tool.c |   2 +-\n diff-lib.c                             |  20 ++---\n diff.c                                 |  38 ++++-----\n diffcore-delta.c                       |  16 ++--\n entry.c                                |  40 +++++-----\n environment.c                          |  24 +++---\n fast-import.c                          |  16 ++--\n fsck.c                                 |   2 +-\n git-compat-util.h                      |   4 +-\n http-push.c                            |   2 +-\n http.c                                 |  10 +--\n imap-send.c                            |  14 ++--\n line-log.c                             |  48 ++++++------\n log-tree.c                             |   2 +-\n object.c                               |   6 +-\n object.h                               |   2 +-\n pack-check.c                           |   2 +-\n packfile.c                             |   8 +-\n reachable.c                            |   2 +-\n read-cache.c                           |  36 ++++-----\n ref-filter.c                           |  20 ++---\n remote.c                               |  16 ++--\n sequencer.c                            |   2 +-\n sha1_file.c                            |  28 +++----\n sha1_name.c                            |   6 +-\n split-index.c                          |  10 +--\n split-index.h                          |   2 +-\n submodule.c                            |  16 ++--\n submodule.h                            |   2 +-\n tag.c                                  |   2 +-\n tempfile.c                             |  12 +--\n tempfile.h                             |  34 ++++----\n trailer.c                              |  44 +++++------\n unpack-trees.c                         |   6 +-\n walker.c                               |   4 +-\n wrapper.c                              |  40 +++++-----\n 63 files changed, 559 insertions(+), 558 deletions(-)\n\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337712","messageId":"20180129223728.30569-2-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 01/37] object_info: change member name from 'typename' to 'type_name'","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:52Z","receivedAt":"2018-01-29T22:37:50Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/cat-file.c |  2 +-\n cache.h            |  2 +-\n packfile.c         |  6 +++---\n sha1_file.c        | 10 +++++-----\n 4 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex f5fa4fd75..d06c66c77 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -76,7 +76,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \tbuf = NULL;\n \tswitch (opt) {\n \tcase 't':\n-\t\toi.typename = &sb;\n+\t\toi.type_name = &sb;\n \t\tif (sha1_object_info_extended(oid.hash, &oi, flags) < 0)\n \t\t\tdie(\"git cat-file: could not get object info\");\n \t\tif (sb.len) {\ndiff --git a/cache.h b/cache.h\nindex d8b975a57..69b5a3bf8 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1744,7 +1744,7 @@ struct object_info {\n \tunsigned long *sizep;\n \toff_t *disk_sizep;\n \tunsigned char *delta_base_sha1;\n-\tstruct strbuf *typename;\n+\tstruct strbuf *type_name;\n \tvoid **contentp;\n \n \t/* Response */\ndiff --git a/packfile.c b/packfile.c\nindex 4a5fe7ab1..6657a0a49 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1350,16 +1350,16 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,\n \t\t*oi->disk_sizep = revidx[1].offset - obj_offset;\n \t}\n \n-\tif (oi->typep || oi->typename) {\n+\tif (oi->typep || oi->type_name) {\n \t\tenum object_type ptot;\n \t\tptot = packed_to_object_type(p, obj_offset, type, &w_curs,\n \t\t\t\t\t     curpos);\n \t\tif (oi->typep)\n \t\t\t*oi->typep = ptot;\n-\t\tif (oi->typename) {\n+\t\tif (oi->type_name) {\n \t\t\tconst char *tn = typename(ptot);\n \t\t\tif (tn)\n-\t\t\t\tstrbuf_addstr(oi->typename, tn);\n+\t\t\t\tstrbuf_addstr(oi->type_name, tn);\n \t\t}\n \t\tif (ptot < 0) {\n \t\t\ttype = OBJ_BAD;\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 3da70ac65..2c03458ea 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1087,8 +1087,8 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,\n \t}\n \n \ttype = type_from_string_gently(type_buf, type_len, 1);\n-\tif (oi->typename)\n-\t\tstrbuf_add(oi->typename, type_buf, type_len);\n+\tif (oi->type_name)\n+\t\tstrbuf_add(oi->type_name, type_buf, type_len);\n \t/*\n \t * Set type to 0 if its an unknown object and\n \t * we're obtaining the type using '--allow-unknown-type'\n@@ -1158,7 +1158,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,\n \t * return value implicitly indicates whether the\n \t * object even exists.\n \t */\n-\tif (!oi->typep && !oi->typename && !oi->sizep && !oi->contentp) {\n+\tif (!oi->typep && !oi->type_name && !oi->sizep && !oi->contentp) {\n \t\tconst char *path;\n \t\tstruct stat st;\n \t\tif (stat_sha1_file(sha1, &st, &path) < 0)\n@@ -1239,8 +1239,8 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\t\t\t*(oi->disk_sizep) = 0;\n \t\t\tif (oi->delta_base_sha1)\n \t\t\t\thashclr(oi->delta_base_sha1);\n-\t\t\tif (oi->typename)\n-\t\t\t\tstrbuf_addstr(oi->typename, typename(co->type));\n+\t\t\tif (oi->type_name)\n+\t\t\t\tstrbuf_addstr(oi->type_name, typename(co->type));\n \t\t\tif (oi->contentp)\n \t\t\t\t*oi->contentp = xmemdupz(co->buf, co->size);\n \t\t\toi->whence = OI_CACHED;\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337713","messageId":"20180129223728.30569-3-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 02/37] object: rename function 'typename' to 'type_name'","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:53Z","receivedAt":"2018-01-29T22:37:54Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/cat-file.c                     |  2 +-\n builtin/diff-tree.c                    |  2 +-\n builtin/fast-export.c                  |  8 ++++----\n builtin/fsck.c                         |  4 ++--\n builtin/grep.c                         |  2 +-\n builtin/index-pack.c                   | 12 ++++++------\n builtin/merge.c                        |  2 +-\n builtin/mktree.c                       |  4 ++--\n builtin/prune.c                        |  2 +-\n builtin/replace.c                      | 12 ++++++------\n builtin/tag.c                          |  2 +-\n builtin/unpack-objects.c               | 10 +++++-----\n builtin/verify-commit.c                |  2 +-\n bulk-checkin.c                         |  2 +-\n commit.c                               |  2 +-\n contrib/examples/builtin-fetch--tool.c |  2 +-\n fast-import.c                          | 16 ++++++++--------\n fsck.c                                 |  2 +-\n http-push.c                            |  2 +-\n log-tree.c                             |  2 +-\n object.c                               |  6 +++---\n object.h                               |  2 +-\n pack-check.c                           |  2 +-\n packfile.c                             |  2 +-\n reachable.c                            |  2 +-\n ref-filter.c                           |  4 ++--\n sequencer.c                            |  2 +-\n sha1_file.c                            | 20 ++++++++++----------\n sha1_name.c                            |  6 +++---\n submodule.c                            |  2 +-\n tag.c                                  |  2 +-\n walker.c                               |  4 ++--\n 32 files changed, 73 insertions(+), 73 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex d06c66c77..c6b3b1bfb 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -229,7 +229,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,\n \t\tif (data->mark_query)\n \t\t\tdata->info.typep = &data->type;\n \t\telse\n-\t\t\tstrbuf_addstr(sb, typename(data->type));\n+\t\t\tstrbuf_addstr(sb, type_name(data->type));\n \t} else if (is_atom(\"objectsize\", atom, len)) {\n \t\tif (data->mark_query)\n \t\t\tdata->info.sizep = &data->size;\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex b775a7564..473615117 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -76,7 +76,7 @@ static int diff_tree_stdin(char *line)\n \tif (obj->type == OBJ_TREE)\n \t\treturn stdin_diff_trees((struct tree *)obj, p);\n \terror(\"Object %s is a %s, not a commit or tree\",\n-\t      oid_to_hex(&oid), typename(obj->type));\n+\t      oid_to_hex(&oid), type_name(obj->type));\n \treturn -1;\n }\n \ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 796d0cd66..27b2cc138 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid)\n \t\tbuf = read_sha1_file(oid->hash, &type, &size);\n \t\tif (!buf)\n \t\t\tdie (\"Could not read blob %s\", oid_to_hex(oid));\n-\t\tif (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)\n+\t\tif (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0)\n \t\t\tdie(\"sha1 mismatch in blob %s\", oid_to_hex(oid));\n \t\tobject = parse_object_buffer(oid, type, size, buf, &eaten);\n \t}\n@@ -757,7 +757,7 @@ static void handle_tag(const char *name, struct tag *tag)\n \t\t\tif (tagged->type != OBJ_COMMIT) {\n \t\t\t\tdie (\"Tag %s tags unexported %s!\",\n \t\t\t\t     oid_to_hex(&tag->object.oid),\n-\t\t\t\t     typename(tagged->type));\n+\t\t\t\t     type_name(tagged->type));\n \t\t\t}\n \t\t\tp = (struct commit *)tagged;\n \t\t\tfor (;;) {\n@@ -839,7 +839,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)\n \t\tif (!commit) {\n \t\t\twarning(\"%s: Unexpected object of type %s, skipping.\",\n \t\t\t\te->name,\n-\t\t\t\ttypename(e->item->type));\n+\t\t\t\ttype_name(e->item->type));\n \t\t\tcontinue;\n \t\t}\n \n@@ -851,7 +851,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)\n \t\t\tcontinue;\n \t\tdefault: /* OBJ_TAG (nested tags) is already handled */\n \t\t\twarning(\"Tag points to object of unexpected type %s, skipping.\",\n-\t\t\t\ttypename(commit->object.type));\n+\t\t\t\ttype_name(commit->object.type));\n \t\t\tcontinue;\n \t\t}\n \ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 04846d46f..246237e81 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -70,7 +70,7 @@ static const char *printable_type(struct object *obj)\n \t\t\tobject_as_type(obj, type, 0);\n \t}\n \n-\tret = typename(obj->type);\n+\tret = type_name(obj->type);\n \tif (!ret)\n \t\tret = \"unknown\";\n \n@@ -137,7 +137,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt\n \t\tprintf(\"broken link from %7s %s\\n\",\n \t\t\t   printable_type(parent), describe_object(parent));\n \t\tprintf(\"broken link from %7s %s\\n\",\n-\t\t\t   (type == OBJ_ANY ? \"unknown\" : typename(type)), \"unknown\");\n+\t\t\t   (type == OBJ_ANY ? \"unknown\" : type_name(type)), \"unknown\");\n \t\terrors_found |= ERROR_REACHABLE;\n \t\treturn 1;\n \t}\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 3ca4ac80d..eb1207095 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -627,7 +627,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,\n \t\tfree(data);\n \t\treturn hit;\n \t}\n-\tdie(_(\"unable to grep from object of type %s\"), typename(obj->type));\n+\tdie(_(\"unable to grep from object of type %s\"), type_name(obj->type));\n }\n \n static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 4c51aec81..8b87090e2 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -228,7 +228,7 @@ static unsigned check_object(struct object *obj)\n \t\tif (type != obj->type)\n \t\t\tdie(_(\"object %s: expected type %s, found %s\"),\n \t\t\t    oid_to_hex(&obj->oid),\n-\t\t\t    typename(obj->type), typename(type));\n+\t\t\t    type_name(obj->type), type_name(type));\n \t\tobj->flags |= FLAG_CHECKED;\n \t\treturn 1;\n \t}\n@@ -448,7 +448,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,\n \tint hdrlen;\n \n \tif (!is_delta_type(type)) {\n-\t\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(type), size) + 1;\n+\t\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(type), size) + 1;\n \t\tgit_SHA1_Init(&c);\n \t\tgit_SHA1_Update(&c, hdr, hdrlen);\n \t} else\n@@ -849,7 +849,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,\n \t\t\tobj = parse_object_buffer(oid, type, size, buf,\n \t\t\t\t\t\t  &eaten);\n \t\t\tif (!obj)\n-\t\t\t\tdie(_(\"invalid %s\"), typename(type));\n+\t\t\t\tdie(_(\"invalid %s\"), type_name(type));\n \t\t\tif (do_fsck_object &&\n \t\t\t    fsck_object(obj, buf, size, &fsck_options))\n \t\t\t\tdie(_(\"Error in object\"));\n@@ -959,7 +959,7 @@ static void resolve_delta(struct object_entry *delta_obj,\n \tif (!result->data)\n \t\tbad_object(delta_obj->idx.offset, _(\"failed to apply delta\"));\n \thash_sha1_file(result->data, result->size,\n-\t\t       typename(delta_obj->real_type),\n+\t\t       type_name(delta_obj->real_type),\n \t\t       delta_obj->idx.oid.hash);\n \tsha1_object(result->data, NULL, result->size, delta_obj->real_type,\n \t\t    &delta_obj->idx.oid);\n@@ -1379,7 +1379,7 @@ static void fix_unresolved_deltas(struct sha1file *f)\n \t\t\tcontinue;\n \n \t\tif (check_sha1_signature(d->sha1, base_obj->data,\n-\t\t\t\tbase_obj->size, typename(type)))\n+\t\t\t\tbase_obj->size, type_name(type)))\n \t\t\tdie(_(\"local object %s is corrupt\"), sha1_to_hex(d->sha1));\n \t\tbase_obj->obj = append_obj_to_pack(f, d->sha1,\n \t\t\t\t\tbase_obj->data, base_obj->size, type);\n@@ -1588,7 +1588,7 @@ static void show_pack_info(int stat_only)\n \t\t\tcontinue;\n \t\tprintf(\"%s %-6s %lu %lu %\"PRIuMAX,\n \t\t       oid_to_hex(&obj->idx.oid),\n-\t\t       typename(obj->real_type), obj->size,\n+\t\t       type_name(obj->real_type), obj->size,\n \t\t       (unsigned long)(obj[1].idx.offset - obj->idx.offset),\n \t\t       (uintmax_t)obj->idx.offset);\n \t\tif (is_delta_type(obj->type)) {\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 30264cfd7..9dec14096 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -520,7 +520,7 @@ static void merge_name(const char *remote, struct strbuf *msg)\n \t\tif (desc && desc->obj && desc->obj->type == OBJ_TAG) {\n \t\t\tstrbuf_addf(msg, \"%s\\t\\t%s '%s'\\n\",\n \t\t\t\t    oid_to_hex(&desc->obj->oid),\n-\t\t\t\t    typename(desc->obj->type),\n+\t\t\t\t    type_name(desc->obj->type),\n \t\t\t\t    remote);\n \t\t\tgoto cleanup;\n \t\t}\ndiff --git a/builtin/mktree.c b/builtin/mktree.c\nindex da0fd8cd7..b7b1cb51f 100644\n--- a/builtin/mktree.c\n+++ b/builtin/mktree.c\n@@ -112,7 +112,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss\n \tmode_type = object_type(mode);\n \tif (mode_type != type_from_string(ptr)) {\n \t\tdie(\"entry '%s' object type (%s) doesn't match mode type (%s)\",\n-\t\t\tpath, ptr, typename(mode_type));\n+\t\t\tpath, ptr, type_name(mode_type));\n \t}\n \n \t/* Check the type of object identified by sha1 */\n@@ -131,7 +131,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss\n \t\t\t * because the new tree entry will never be correct.\n \t\t\t */\n \t\t\tdie(\"entry '%s' object %s is a %s but specified type was (%s)\",\n-\t\t\t\tpath, sha1_to_hex(sha1), typename(obj_type), typename(mode_type));\n+\t\t\t\tpath, sha1_to_hex(sha1), type_name(obj_type), type_name(mode_type));\n \t\t}\n \t}\n \ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex d2fdae680..c175f154e 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -52,7 +52,7 @@ static int prune_object(const struct object_id *oid, const char *fullpath,\n \tif (show_only || verbose) {\n \t\tenum object_type type = sha1_object_info(oid->hash, NULL);\n \t\tprintf(\"%s %s\\n\", oid_to_hex(oid),\n-\t\t       (type > 0) ? typename(type) : \"unknown\");\n+\t\t       (type > 0) ? type_name(type) : \"unknown\");\n \t}\n \tif (!show_only)\n \t\tunlink_or_warn(fullpath);\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 10078ae37..42cf4f62a 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -56,8 +56,8 @@ static int show_reference(const char *refname, const struct object_id *oid,\n \t\t\tobj_type = sha1_object_info(object.hash, NULL);\n \t\t\trepl_type = sha1_object_info(oid->hash, NULL);\n \n-\t\t\tprintf(\"%s (%s) -> %s (%s)\\n\", refname, typename(obj_type),\n-\t\t\t       oid_to_hex(oid), typename(repl_type));\n+\t\t\tprintf(\"%s (%s) -> %s (%s)\\n\", refname, type_name(obj_type),\n+\t\t\t       oid_to_hex(oid), type_name(repl_type));\n \t\t}\n \t}\n \n@@ -168,8 +168,8 @@ static int replace_object_oid(const char *object_ref,\n \t\tdie(\"Objects must be of the same type.\\n\"\n \t\t    \"'%s' points to a replaced object of type '%s'\\n\"\n \t\t    \"while '%s' points to a replacement object of type '%s'.\",\n-\t\t    object_ref, typename(obj_type),\n-\t\t    replace_ref, typename(repl_type));\n+\t\t    object_ref, type_name(obj_type),\n+\t\t    replace_ref, type_name(repl_type));\n \n \tcheck_ref_valid(object, &prev, &ref, force);\n \n@@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,\n \targv_array_push(&cmd.args, \"--no-replace-objects\");\n \targv_array_push(&cmd.args, \"cat-file\");\n \tif (raw)\n-\t\targv_array_push(&cmd.args, typename(type));\n+\t\targv_array_push(&cmd.args, type_name(type));\n \telse\n \t\targv_array_push(&cmd.args, \"-p\");\n \targv_array_push(&cmd.args, oid_to_hex(oid));\n@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,\n \tstruct tag *tag;\n \tint i;\n \n-\thash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);\n+\thash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);\n \ttag = lookup_tag(&tag_oid);\n \tif (!tag)\n \t\tdie(_(\"bad mergetag in commit '%s'\"), ref);\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex a7e6a5b0f..7e0881fba 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -220,7 +220,7 @@ static void create_tag(const struct object_id *object, const char *tag,\n \t\t    \"tag %s\\n\"\n \t\t    \"tagger %s\\n\\n\",\n \t\t    oid_to_hex(object),\n-\t\t    typename(type),\n+\t\t    type_name(type),\n \t\t    tag,\n \t\t    git_committer_info(IDENT_STRICT));\n \ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 62ea264c4..e93079070 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -172,7 +172,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)\n {\n \tstruct object_id oid;\n \n-\tif (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0)\n+\tif (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)\n \t\tdie(\"failed to write object %s\", oid_to_hex(&obj->oid));\n \tobj->flags |= FLAG_WRITTEN;\n }\n@@ -237,14 +237,14 @@ static void write_object(unsigned nr, enum object_type type,\n \t\t\t void *buf, unsigned long size)\n {\n \tif (!strict) {\n-\t\tif (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)\n+\t\tif (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)\n \t\t\tdie(\"failed to write object\");\n \t\tadded_object(nr, type, buf, size);\n \t\tfree(buf);\n \t\tobj_list[nr].obj = NULL;\n \t} else if (type == OBJ_BLOB) {\n \t\tstruct blob *blob;\n-\t\tif (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)\n+\t\tif (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)\n \t\t\tdie(\"failed to write object\");\n \t\tadded_object(nr, type, buf, size);\n \t\tfree(buf);\n@@ -258,12 +258,12 @@ static void write_object(unsigned nr, enum object_type type,\n \t} else {\n \t\tstruct object *obj;\n \t\tint eaten;\n-\t\thash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);\n+\t\thash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);\n \t\tadded_object(nr, type, buf, size);\n \t\tobj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,\n \t\t\t\t\t  &eaten);\n \t\tif (!obj)\n-\t\t\tdie(\"invalid %s\", typename(type));\n+\t\t\tdie(\"invalid %s\", type_name(type));\n \t\tadd_object_buffer(obj, buf, size);\n \t\tobj->flags |= FLAG_OPEN;\n \t\tobj_list[nr].obj = obj;\ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex ba38ac9b1..05315ea7c 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -49,7 +49,7 @@ static int verify_commit(const char *name, unsigned flags)\n \t\treturn error(\"%s: unable to read file.\", name);\n \tif (type != OBJ_COMMIT)\n \t\treturn error(\"%s: cannot verify a non-commit object of type %s.\",\n-\t\t\t\tname, typename(type));\n+\t\t\t\tname, type_name(type));\n \n \tret = run_gpg_verify(&oid, buf, size, flags);\n \ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex 3310fd210..bb788494f 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -203,7 +203,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,\n \t\treturn error(\"cannot find the current offset\");\n \n \theader_len = xsnprintf((char *)obuf, sizeof(obuf), \"%s %\" PRIuMAX,\n-\t\t\t       typename(type), (uintmax_t)size) + 1;\n+\t\t\t       type_name(type), (uintmax_t)size) + 1;\n \tgit_SHA1_Init(&ctx);\n \tgit_SHA1_Update(&ctx, obuf, header_len);\n \ndiff --git a/commit.c b/commit.c\nindex ff51c9f34..cd9ace105 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -274,7 +274,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)\n \t\t\t    oid_to_hex(&commit->object.oid));\n \t\tif (type != OBJ_COMMIT)\n \t\t\tdie(\"expected commit for %s, got %s\",\n-\t\t\t    oid_to_hex(&commit->object.oid), typename(type));\n+\t\t\t    oid_to_hex(&commit->object.oid), type_name(type));\n \t\tif (sizep)\n \t\t\t*sizep = size;\n \t}\ndiff --git a/contrib/examples/builtin-fetch--tool.c b/contrib/examples/builtin-fetch--tool.c\nindex a3eb19de0..22648c3af 100644\n--- a/contrib/examples/builtin-fetch--tool.c\n+++ b/contrib/examples/builtin-fetch--tool.c\n@@ -15,7 +15,7 @@ static char *get_stdin(void)\n \n static void show_new(enum object_type type, unsigned char *sha1_new)\n {\n-\tfprintf(stderr, \"  %s: %s\\n\", typename(type),\n+\tfprintf(stderr, \"  %s: %s\\n\", type_name(type),\n \t\tfind_unique_abbrev(sha1_new, DEFAULT_ABBREV));\n }\n \ndiff --git a/fast-import.c b/fast-import.c\nindex b70ac025e..92b89d191 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1096,7 +1096,7 @@ static int store_object(\n \tgit_zstream s;\n \n \thdrlen = xsnprintf((char *)hdr, sizeof(hdr), \"%s %lu\",\n-\t\t\t   typename(type), (unsigned long)dat->len) + 1;\n+\t\t\t   type_name(type), (unsigned long)dat->len) + 1;\n \tgit_SHA1_Init(&c);\n \tgit_SHA1_Update(&c, hdr, hdrlen);\n \tgit_SHA1_Update(&c, dat->buf, dat->len);\n@@ -2421,7 +2421,7 @@ static void file_change_m(const char *p, struct branch *b)\n \t\telse if (oe) {\n \t\t\tif (oe->type != OBJ_COMMIT)\n \t\t\t\tdie(\"Not a commit (actually a %s): %s\",\n-\t\t\t\t\ttypename(oe->type), command_buf.buf);\n+\t\t\t\t\ttype_name(oe->type), command_buf.buf);\n \t\t}\n \t\t/*\n \t\t * Accept the sha1 without checking; it expected to be in\n@@ -2448,7 +2448,7 @@ static void file_change_m(const char *p, struct branch *b)\n \t\t\t\t\tcommand_buf.buf);\n \t\tif (type != expected)\n \t\t\tdie(\"Not a %s (actually a %s): %s\",\n-\t\t\t\ttypename(expected), typename(type),\n+\t\t\t\ttype_name(expected), type_name(type),\n \t\t\t\tcommand_buf.buf);\n \t}\n \n@@ -2599,14 +2599,14 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa\n \t} else if (oe) {\n \t\tif (oe->type != OBJ_BLOB)\n \t\t\tdie(\"Not a blob (actually a %s): %s\",\n-\t\t\t\ttypename(oe->type), command_buf.buf);\n+\t\t\t\ttype_name(oe->type), command_buf.buf);\n \t} else if (!is_null_oid(&oid)) {\n \t\tenum object_type type = sha1_object_info(oid.hash, NULL);\n \t\tif (type < 0)\n \t\t\tdie(\"Blob not found: %s\", command_buf.buf);\n \t\tif (type != OBJ_BLOB)\n \t\t\tdie(\"Not a blob (actually a %s): %s\",\n-\t\t\t    typename(type), command_buf.buf);\n+\t\t\t    type_name(type), command_buf.buf);\n \t}\n \n \tconstruct_path_with_fanout(oid_to_hex(&commit_oid), *old_fanout, path);\n@@ -2914,7 +2914,7 @@ static void parse_new_tag(const char *arg)\n \t\t    \"object %s\\n\"\n \t\t    \"type %s\\n\"\n \t\t    \"tag %s\\n\",\n-\t\t    oid_to_hex(&oid), typename(type), t->name);\n+\t\t    oid_to_hex(&oid), type_name(type), t->name);\n \tif (tagger)\n \t\tstrbuf_addf(&new_data,\n \t\t\t    \"tagger %s\\n\", tagger);\n@@ -2985,10 +2985,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)\n \t\tdie(\"Can't read object %s\", oid_to_hex(oid));\n \tif (type != OBJ_BLOB)\n \t\tdie(\"Object %s is a %s but a blob was expected.\",\n-\t\t    oid_to_hex(oid), typename(type));\n+\t\t    oid_to_hex(oid), type_name(type));\n \tstrbuf_reset(&line);\n \tstrbuf_addf(&line, \"%s %s %lu\\n\", oid_to_hex(oid),\n-\t\t\t\t\t\ttypename(type), size);\n+\t\t\t\t\t\ttype_name(type), size);\n \tcat_blob_write(line.buf, line.len);\n \tstrbuf_release(&line);\n \tcat_blob_write(buf, size);\ndiff --git a/fsck.c b/fsck.c\nindex 032699e9a..5c8c12dde 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -821,7 +821,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,\n \t\t\tret = report(options, &tag->object,\n \t\t\t\tFSCK_MSG_TAG_OBJECT_NOT_TAG,\n \t\t\t\t\"expected tag got %s\",\n-\t\t\t    typename(type));\n+\t\t\t    type_name(type));\n \t\t\tgoto done;\n \t\t}\n \t}\ndiff --git a/http-push.c b/http-push.c\nindex 14435ab65..8814aa12e 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -362,7 +362,7 @@ static void start_put(struct transfer_request *request)\n \tgit_zstream stream;\n \n \tunpacked = read_sha1_file(request->obj->oid.hash, &type, &len);\n-\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(type), len) + 1;\n+\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(type), len) + 1;\n \n \t/* Set it up */\n \tgit_deflate_init(&stream, zlib_compression_level);\ndiff --git a/log-tree.c b/log-tree.c\nindex fca29d479..2eeddbeb3 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -499,7 +499,7 @@ static void show_one_mergetag(struct commit *commit,\n \tint status, nth;\n \tsize_t payload_size, gpg_message_offset;\n \n-\thash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);\n+\thash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);\n \ttag = lookup_tag(&oid);\n \tif (!tag)\n \t\treturn; /* error message already given */\ndiff --git a/object.c b/object.c\nindex 0afdfd19b..0db33b26b 100644\n--- a/object.c\n+++ b/object.c\n@@ -26,7 +26,7 @@ static const char *object_type_strings[] = {\n \t\"tag\",\t\t/* OBJ_TAG = 4 */\n };\n \n-const char *typename(unsigned int type)\n+const char *type_name(unsigned int type)\n {\n \tif (type >= ARRAY_SIZE(object_type_strings))\n \t\treturn NULL;\n@@ -166,7 +166,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)\n \t\tif (!quiet)\n \t\t\terror(\"object %s is a %s, not a %s\",\n \t\t\t      oid_to_hex(&obj->oid),\n-\t\t\t      typename(obj->type), typename(type));\n+\t\t\t      type_name(obj->type), type_name(type));\n \t\treturn NULL;\n \t}\n }\n@@ -265,7 +265,7 @@ struct object *parse_object(const struct object_id *oid)\n \n \tbuffer = read_sha1_file(oid->hash, &type, &size);\n \tif (buffer) {\n-\t\tif (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {\n+\t\tif (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {\n \t\t\tfree(buffer);\n \t\t\terror(\"sha1 mismatch %s\", sha1_to_hex(repl));\n \t\t\treturn NULL;\ndiff --git a/object.h b/object.h\nindex 87563d905..a5eb26380 100644\n--- a/object.h\n+++ b/object.h\n@@ -53,7 +53,7 @@ struct object {\n \tstruct object_id oid;\n };\n \n-extern const char *typename(unsigned int type);\n+extern const char *type_name(unsigned int type);\n extern int type_from_string_gently(const char *str, ssize_t, int gentle);\n #define type_from_string(str) type_from_string_gently(str, -1, 0)\n \ndiff --git a/pack-check.c b/pack-check.c\nindex 073c1fbd4..bd348592f 100644\n--- a/pack-check.c\n+++ b/pack-check.c\n@@ -141,7 +141,7 @@ static int verify_packfile(struct packed_git *p,\n \t\t\terr = error(\"cannot unpack %s from %s at offset %\"PRIuMAX\"\",\n \t\t\t\t    oid_to_hex(entries[i].oid.oid), p->pack_name,\n \t\t\t\t    (uintmax_t)entries[i].offset);\n-\t\telse if (check_sha1_signature(entries[i].oid.hash, data, size, typename(type)))\n+\t\telse if (check_sha1_signature(entries[i].oid.hash, data, size, type_name(type)))\n \t\t\terr = error(\"packed %s from %s is corrupt\",\n \t\t\t\t    oid_to_hex(entries[i].oid.oid), p->pack_name);\n \t\telse if (fn) {\ndiff --git a/packfile.c b/packfile.c\nindex 6657a0a49..0532a371b 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1357,7 +1357,7 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,\n \t\tif (oi->typep)\n \t\t\t*oi->typep = ptot;\n \t\tif (oi->type_name) {\n-\t\t\tconst char *tn = typename(ptot);\n+\t\t\tconst char *tn = type_name(ptot);\n \t\t\tif (tn)\n \t\t\t\tstrbuf_addstr(oi->type_name, tn);\n \t\t}\ndiff --git a/reachable.c b/reachable.c\nindex 88d7d679d..191ebe3e6 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -94,7 +94,7 @@ static void add_recent_object(const struct object_id *oid,\n \t\tbreak;\n \tdefault:\n \t\tdie(\"unknown object type for %s: %s\",\n-\t\t    oid_to_hex(oid), typename(type));\n+\t\t    oid_to_hex(oid), type_name(type));\n \t}\n \n \tif (!obj)\ndiff --git a/ref-filter.c b/ref-filter.c\nindex f9e25aea7..9dae6cfe3 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -769,7 +769,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object\n \t\tif (deref)\n \t\t\tname++;\n \t\tif (!strcmp(name, \"objecttype\"))\n-\t\t\tv->s = typename(obj->type);\n+\t\t\tv->s = type_name(obj->type);\n \t\telse if (!strcmp(name, \"objectsize\")) {\n \t\t\tv->value = sz;\n \t\t\tv->s = xstrfmt(\"%lu\", sz);\n@@ -795,7 +795,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob\n \t\tif (!strcmp(name, \"tag\"))\n \t\t\tv->s = tag->tag;\n \t\telse if (!strcmp(name, \"type\") && tag->tagged)\n-\t\t\tv->s = typename(tag->tagged->type);\n+\t\t\tv->s = type_name(tag->tagged->type);\n \t\telse if (!strcmp(name, \"object\") && tag->tagged)\n \t\t\tv->s = xstrdup(oid_to_hex(&tag->tagged->oid));\n \t}\ndiff --git a/sequencer.c b/sequencer.c\nindex 4d3f60594..f6b77e6bd 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2348,7 +2348,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)\n \t\t\tif (!lookup_commit_reference_gently(&oid, 1)) {\n \t\t\t\tenum object_type type = sha1_object_info(oid.hash, NULL);\n \t\t\t\treturn error(_(\"%s: can't cherry-pick a %s\"),\n-\t\t\t\t\tname, typename(type));\n+\t\t\t\t\tname, type_name(type));\n \t\t\t}\n \t\t} else\n \t\t\treturn error(_(\"%s: bad revision\"), name);\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 2c03458ea..2288bb75c 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -805,7 +805,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,\n \t\treturn -1;\n \n \t/* Generate the header */\n-\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(obj_type), size) + 1;\n+\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(obj_type), size) + 1;\n \n \t/* Sha1.. */\n \tgit_SHA1_Init(&c);\n@@ -1240,7 +1240,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\t\tif (oi->delta_base_sha1)\n \t\t\t\thashclr(oi->delta_base_sha1);\n \t\t\tif (oi->type_name)\n-\t\t\t\tstrbuf_addstr(oi->type_name, typename(co->type));\n+\t\t\t\tstrbuf_addstr(oi->type_name, type_name(co->type));\n \t\t\tif (oi->contentp)\n \t\t\t\t*oi->contentp = xmemdupz(co->buf, co->size);\n \t\t\toi->whence = OI_CACHED;\n@@ -1317,7 +1317,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,\n {\n \tstruct cached_object *co;\n \n-\thash_sha1_file(buf, len, typename(type), sha1);\n+\thash_sha1_file(buf, len, type_name(type), sha1);\n \tif (has_sha1_file(sha1) || find_cached_object(sha1))\n \t\treturn 0;\n \tALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);\n@@ -1683,7 +1683,7 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)\n \tbuf = read_object(sha1, &type, &len);\n \tif (!buf)\n \t\treturn error(\"cannot read sha1_file for %s\", sha1_to_hex(sha1));\n-\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(type), len) + 1;\n+\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(type), len) + 1;\n \tret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);\n \tfree(buf);\n \n@@ -1767,9 +1767,9 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,\n \t}\n \n \tif (write_object)\n-\t\tret = write_sha1_file(buf, size, typename(type), oid->hash);\n+\t\tret = write_sha1_file(buf, size, type_name(type), oid->hash);\n \telse\n-\t\tret = hash_sha1_file(buf, size, typename(type), oid->hash);\n+\t\tret = hash_sha1_file(buf, size, type_name(type), oid->hash);\n \tif (re_allocated)\n \t\tfree(buf);\n \treturn ret;\n@@ -1789,10 +1789,10 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,\n \t\t\t\t get_safe_crlf(flags));\n \n \tif (write_object)\n-\t\tret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),\n+\t\tret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),\n \t\t\t\t      oid->hash);\n \telse\n-\t\tret = hash_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),\n+\t\tret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),\n \t\t\t\t     oid->hash);\n \tstrbuf_release(&sbuf);\n \treturn ret;\n@@ -1942,7 +1942,7 @@ void assert_sha1_type(const unsigned char *sha1, enum object_type expect)\n \t\tdie(\"%s is not a valid object\", sha1_to_hex(sha1));\n \tif (type != expect)\n \t\tdie(\"%s is not a valid '%s' object\", sha1_to_hex(sha1),\n-\t\t    typename(expect));\n+\t\t    type_name(expect));\n }\n \n int for_each_file_in_obj_subdir(unsigned int subdir_nr,\n@@ -2187,7 +2187,7 @@ int read_loose_object(const char *path,\n \t\t\tgoto out;\n \t\t}\n \t\tif (check_sha1_signature(expected_sha1, *contents,\n-\t\t\t\t\t *size, typename(*type))) {\n+\t\t\t\t\t *size, type_name(*type))) {\n \t\t\terror(\"sha1 mismatch for %s (expected %s)\", path,\n \t\t\t      sha1_to_hex(expected_sha1));\n \t\t\tfree(*contents);\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 611c7d24d..e7c18ffc2 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -381,7 +381,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)\n \n \tadvise(\"  %s %s%s\",\n \t       find_unique_abbrev(oid->hash, DEFAULT_ABBREV),\n-\t       typename(type) ? typename(type) : \"unknown type\",\n+\t       type_name(type) ? type_name(type) : \"unknown type\",\n \t       desc.buf);\n \n \tstrbuf_release(&desc);\n@@ -901,8 +901,8 @@ struct object *peel_to_type(const char *name, int namelen,\n \t\t\tif (name)\n \t\t\t\terror(\"%.*s: expected %s type, but the object \"\n \t\t\t\t      \"dereferences to %s type\",\n-\t\t\t\t      namelen, name, typename(expected_type),\n-\t\t\t\t      typename(o->type));\n+\t\t\t\t      namelen, name, type_name(expected_type),\n+\t\t\t\t      type_name(o->type));\n \t\t\treturn NULL;\n \t\t}\n \t}\ndiff --git a/submodule.c b/submodule.c\nindex 47ddc9b27..cd18400e8 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -831,7 +831,7 @@ static int check_has_commit(const struct object_id *oid, void *data)\n \t\treturn 0;\n \tdefault:\n \t\tdie(_(\"submodule entry '%s' (%s) is a %s, not a commit\"),\n-\t\t    cb->path, oid_to_hex(oid), typename(type));\n+\t\t    cb->path, oid_to_hex(oid), type_name(type));\n \t}\n }\n \ndiff --git a/tag.c b/tag.c\nindex fcbe012f7..66210fd47 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -47,7 +47,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\t\t\tname_to_report ?\n \t\t\t\tname_to_report :\n \t\t\t\tfind_unique_abbrev(oid->hash, DEFAULT_ABBREV),\n-\t\t\t\ttypename(type));\n+\t\t\t\ttype_name(type));\n \n \tbuf = read_sha1_file(oid->hash, &type, &size);\n \tif (!buf)\ndiff --git a/walker.c b/walker.c\nindex 5d4d3733f..dffb9c8e3 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -22,7 +22,7 @@ void walker_say(struct walker *walker, const char *fmt, ...)\n static void report_missing(const struct object *obj)\n {\n \tfprintf(stderr, \"Cannot obtain needed %s %s\\n\",\n-\t\tobj->type ? typename(obj->type): \"object\",\n+\t\tobj->type ? type_name(obj->type): \"object\",\n \t\toid_to_hex(&obj->oid));\n \tif (!is_null_oid(&current_commit_oid))\n \t\tfprintf(stderr, \"while processing commit %s.\\n\",\n@@ -134,7 +134,7 @@ static int process_object(struct walker *walker, struct object *obj)\n \t}\n \treturn error(\"Unable to determine requirements \"\n \t\t     \"of type %s for %s\",\n-\t\t     typename(obj->type), oid_to_hex(&obj->oid));\n+\t\t     type_name(obj->type), oid_to_hex(&obj->oid));\n }\n \n static int process(struct walker *walker, struct object *obj)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337714","messageId":"20180129223728.30569-4-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 03/37] blame: rename 'this' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:54Z","receivedAt":"2018-01-29T22:37:57Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n blame.c | 33 +++++++++++++++++----------------\n 1 file changed, 17 insertions(+), 16 deletions(-)\n\ndiff --git a/blame.c b/blame.c\nindex 2893f3c10..21c867664 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -998,28 +998,29 @@ unsigned blame_entry_score(struct blame_scoreboard *sb, struct blame_entry *e)\n }\n \n /*\n- * best_so_far[] and this[] are both a split of an existing blame_entry\n- * that passes blame to the parent.  Maintain best_so_far the best split\n- * so far, by comparing this and best_so_far and copying this into\n+ * best_so_far[] and potential[] are both a split of an existing blame_entry\n+ * that passes blame to the parent.  Maintain best_so_far the best split so\n+ * far, by comparing potential and best_so_far and copying potential into\n  * bst_so_far as needed.\n  */\n static void copy_split_if_better(struct blame_scoreboard *sb,\n \t\t\t\t struct blame_entry *best_so_far,\n-\t\t\t\t struct blame_entry *this)\n+\t\t\t\t struct blame_entry *potential)\n {\n \tint i;\n \n-\tif (!this[1].suspect)\n+\tif (!potential[1].suspect)\n \t\treturn;\n \tif (best_so_far[1].suspect) {\n-\t\tif (blame_entry_score(sb, &this[1]) < blame_entry_score(sb, &best_so_far[1]))\n+\t\tif (blame_entry_score(sb, &potential[1]) <\n+\t\t    blame_entry_score(sb, &best_so_far[1]))\n \t\t\treturn;\n \t}\n \n \tfor (i = 0; i < 3; i++)\n-\t\tblame_origin_incref(this[i].suspect);\n+\t\tblame_origin_incref(potential[i].suspect);\n \tdecref_split(best_so_far);\n-\tmemcpy(best_so_far, this, sizeof(struct blame_entry [3]));\n+\tmemcpy(best_so_far, potential, sizeof(struct blame_entry[3]));\n }\n \n /*\n@@ -1046,12 +1047,12 @@ static void handle_split(struct blame_scoreboard *sb,\n \tif (ent->num_lines <= tlno)\n \t\treturn;\n \tif (tlno < same) {\n-\t\tstruct blame_entry this[3];\n+\t\tstruct blame_entry potential[3];\n \t\ttlno += ent->s_lno;\n \t\tsame += ent->s_lno;\n-\t\tsplit_overlap(this, ent, tlno, plno, same, parent);\n-\t\tcopy_split_if_better(sb, split, this);\n-\t\tdecref_split(this);\n+\t\tsplit_overlap(potential, ent, tlno, plno, same, parent);\n+\t\tcopy_split_if_better(sb, split, potential);\n+\t\tdecref_split(potential);\n \t}\n }\n \n@@ -1273,7 +1274,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,\n \t\t\tstruct diff_filepair *p = diff_queued_diff.queue[i];\n \t\t\tstruct blame_origin *norigin;\n \t\t\tmmfile_t file_p;\n-\t\t\tstruct blame_entry this[3];\n+\t\t\tstruct blame_entry potential[3];\n \n \t\t\tif (!DIFF_FILE_VALID(p->one))\n \t\t\t\tcontinue; /* does not exist in parent */\n@@ -1292,10 +1293,10 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,\n \n \t\t\tfor (j = 0; j < num_ents; j++) {\n \t\t\t\tfind_copy_in_blob(sb, blame_list[j].ent,\n-\t\t\t\t\t\t  norigin, this, &file_p);\n+\t\t\t\t\t\t  norigin, potential, &file_p);\n \t\t\t\tcopy_split_if_better(sb, blame_list[j].split,\n-\t\t\t\t\t\t     this);\n-\t\t\t\tdecref_split(this);\n+\t\t\t\t\t\t     potential);\n+\t\t\t\tdecref_split(potential);\n \t\t\t}\n \t\t\tblame_origin_decref(norigin);\n \t\t}\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337715","messageId":"20180129223728.30569-5-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 04/37] pack-objects: rename 'this' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:55Z","receivedAt":"2018-01-29T22:37:59Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/pack-objects.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 6b9cfc289..bfda8602c 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1376,10 +1376,10 @@ static void cleanup_preferred_base(void)\n \tit = pbase_tree;\n \tpbase_tree = NULL;\n \twhile (it) {\n-\t\tstruct pbase_tree *this = it;\n-\t\tit = this->next;\n-\t\tfree(this->pcache.tree_data);\n-\t\tfree(this);\n+\t\tstruct pbase_tree *tmp = it;\n+\t\tit = tmp->next;\n+\t\tfree(tmp->pcache.tree_data);\n+\t\tfree(tmp);\n \t}\n \n \tfor (i = 0; i < ARRAY_SIZE(pbase_tree_cache); i++) {\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337716","messageId":"20180129223728.30569-6-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 05/37] rev-parse: rename 'this' variable","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:56Z","receivedAt":"2018-01-29T22:38:03Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/rev-parse.c | 34 +++++++++++++++++-----------------\n 1 file changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 74aa644cb..171c7a2b4 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -243,28 +243,28 @@ static int show_file(const char *arg, int output_prefix)\n static int try_difference(const char *arg)\n {\n \tchar *dotdot;\n-\tstruct object_id oid;\n-\tstruct object_id end;\n-\tconst char *next;\n-\tconst char *this;\n+\tstruct object_id start_oid;\n+\tstruct object_id end_oid;\n+\tconst char *end;\n+\tconst char *start;\n \tint symmetric;\n \tstatic const char head_by_default[] = \"HEAD\";\n \n \tif (!(dotdot = strstr(arg, \"..\")))\n \t\treturn 0;\n-\tnext = dotdot + 2;\n-\tthis = arg;\n-\tsymmetric = (*next == '.');\n+\tend = dotdot + 2;\n+\tstart = arg;\n+\tsymmetric = (*end == '.');\n \n \t*dotdot = 0;\n-\tnext += symmetric;\n+\tend += symmetric;\n \n-\tif (!*next)\n-\t\tnext = head_by_default;\n+\tif (!*end)\n+\t\tend = head_by_default;\n \tif (dotdot == arg)\n-\t\tthis = head_by_default;\n+\t\tstart = head_by_default;\n \n-\tif (this == head_by_default && next == head_by_default &&\n+\tif (start == head_by_default && end == head_by_default &&\n \t    !symmetric) {\n \t\t/*\n \t\t * Just \"..\"?  That is not a range but the\n@@ -274,14 +274,14 @@ static int try_difference(const char *arg)\n \t\treturn 0;\n \t}\n \n-\tif (!get_oid_committish(this, &oid) && !get_oid_committish(next, &end)) {\n-\t\tshow_rev(NORMAL, &end, next);\n-\t\tshow_rev(symmetric ? NORMAL : REVERSED, &oid, this);\n+\tif (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {\n+\t\tshow_rev(NORMAL, &end_oid, end);\n+\t\tshow_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);\n \t\tif (symmetric) {\n \t\t\tstruct commit_list *exclude;\n \t\t\tstruct commit *a, *b;\n-\t\t\ta = lookup_commit_reference(&oid);\n-\t\t\tb = lookup_commit_reference(&end);\n+\t\t\ta = lookup_commit_reference(&start_oid);\n+\t\t\tb = lookup_commit_reference(&end_oid);\n \t\t\texclude = get_merge_bases(a, b);\n \t\t\twhile (exclude) {\n \t\t\t\tstruct commit *commit = pop_commit(&exclude);\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337717","messageId":"20180129223728.30569-7-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 06/37] diff: rename 'this' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:57Z","receivedAt":"2018-01-29T22:38:05Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 0a9a0cdf1..d682d0d1f 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n \twhile (dir->nr) {\n \t\tstruct dirstat_file *f = dir->files;\n \t\tint namelen = strlen(f->name);\n-\t\tunsigned long this;\n+\t\tunsigned long sum;\n \t\tchar *slash;\n \n \t\tif (namelen < baselen)\n@@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n \t\tslash = strchr(f->name + baselen, '/');\n \t\tif (slash) {\n \t\t\tint newbaselen = slash + 1 - f->name;\n-\t\t\tthis = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n+\t\t\tsum = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n \t\t\tsources++;\n \t\t} else {\n-\t\t\tthis = f->changed;\n+\t\t\tsum = f->changed;\n \t\t\tdir->files++;\n \t\t\tdir->nr--;\n \t\t\tsources += 2;\n \t\t}\n-\t\tthis_dir += this;\n+\t\tthis_dir += sum;\n \t}\n \n \t/*\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337718","messageId":"20180129223728.30569-9-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 08/37] apply: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:59Z","receivedAt":"2018-01-29T22:38:08Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n apply.c | 38 +++++++++++++++++++-------------------\n 1 file changed, 19 insertions(+), 19 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 071f653c6..657c73930 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,\n \t\t\t\t   size_t len, size_t postlen)\n {\n \tint i, ctx, reduced;\n-\tchar *new, *old, *fixed;\n+\tchar *new_buf, *old, *fixed;\n \tstruct image fixed_preimage;\n \n \t/*\n@@ -2329,18 +2329,18 @@ static void update_pre_post_images(struct image *preimage,\n \t */\n \told = postimage->buf;\n \tif (postlen)\n-\t\tnew = postimage->buf = xmalloc(postlen);\n+\t\tnew_buf = postimage->buf = xmalloc(postlen);\n \telse\n-\t\tnew = old;\n+\t\tnew_buf = old;\n \tfixed = preimage->buf;\n \n \tfor (i = reduced = ctx = 0; i < postimage->nr; i++) {\n \t\tsize_t l_len = postimage->line[i].len;\n \t\tif (!(postimage->line[i].flag & LINE_COMMON)) {\n \t\t\t/* an added line -- no counterparts in preimage */\n-\t\t\tmemmove(new, old, l_len);\n+\t\t\tmemmove(new_buf, old, l_len);\n \t\t\told += l_len;\n-\t\t\tnew += l_len;\n+\t\t\tnew_buf += l_len;\n \t\t\tcontinue;\n \t\t}\n \n@@ -2365,21 +2365,21 @@ static void update_pre_post_images(struct image *preimage,\n \n \t\t/* and copy it in, while fixing the line length */\n \t\tl_len = preimage->line[ctx].len;\n-\t\tmemcpy(new, fixed, l_len);\n-\t\tnew += l_len;\n+\t\tmemcpy(new_buf, fixed, l_len);\n+\t\tnew_buf += l_len;\n \t\tfixed += l_len;\n \t\tpostimage->line[i].len = l_len;\n \t\tctx++;\n \t}\n \n \tif (postlen\n-\t    ? postlen < new - postimage->buf\n-\t    : postimage->len < new - postimage->buf)\n+\t    ? postlen < new_buf - postimage->buf\n+\t    : postimage->len < new_buf - postimage->buf)\n \t\tdie(\"BUG: caller miscounted postlen: asked %d, orig = %d, used = %d\",\n-\t\t    (int)postlen, (int) postimage->len, (int)(new - postimage->buf));\n+\t\t    (int)postlen, (int) postimage->len, (int)(new_buf - postimage->buf));\n \n \t/* Fix the length of the whole thing */\n-\tpostimage->len = new - postimage->buf;\n+\tpostimage->len = new_buf - postimage->buf;\n \tpostimage->nr -= reduced;\n }\n \n@@ -4163,30 +4163,30 @@ static void show_mode_change(struct patch *p, int show_name)\n static void show_rename_copy(struct patch *p)\n {\n \tconst char *renamecopy = p->is_rename ? \"rename\" : \"copy\";\n-\tconst char *old, *new;\n+\tconst char *old, *new_name;\n \n \t/* Find common prefix */\n \told = p->old_name;\n-\tnew = p->new_name;\n+\tnew_name = p->new_name;\n \twhile (1) {\n \t\tconst char *slash_old, *slash_new;\n \t\tslash_old = strchr(old, '/');\n-\t\tslash_new = strchr(new, '/');\n+\t\tslash_new = strchr(new_name, '/');\n \t\tif (!slash_old ||\n \t\t    !slash_new ||\n-\t\t    slash_old - old != slash_new - new ||\n-\t\t    memcmp(old, new, slash_new - new))\n+\t\t    slash_old - old != slash_new - new_name ||\n+\t\t    memcmp(old, new_name, slash_new - new_name))\n \t\t\tbreak;\n \t\told = slash_old + 1;\n-\t\tnew = slash_new + 1;\n+\t\tnew_name = slash_new + 1;\n \t}\n-\t/* p->old_name thru old is the common prefix, and old and new\n+\t/* p->old_name thru old is the common prefix, and old and new_name\n \t * through the end of names are renames\n \t */\n \tif (old != p->old_name)\n \t\tprintf(\" %s %.*s{%s => %s} (%d%%)\\n\", renamecopy,\n \t\t       (int)(old - p->old_name), p->old_name,\n-\t\t       old, new, p->score);\n+\t\t       old, new_name, p->score);\n \telse\n \t\tprintf(\" %s %s => %s (%d%%)\\n\", renamecopy,\n \t\t       p->old_name, p->new_name, p->score);\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337719","messageId":"20180129223728.30569-8-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 07/37] apply: rename 'try' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:36:58Z","receivedAt":"2018-01-29T22:38:11Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n apply.c | 68 ++++++++++++++++++++++++++++++++---------------------------------\n 1 file changed, 34 insertions(+), 34 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 321a9fa68..071f653c6 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -2386,8 +2386,8 @@ static void update_pre_post_images(struct image *preimage,\n static int line_by_line_fuzzy_match(struct image *img,\n \t\t\t\t    struct image *preimage,\n \t\t\t\t    struct image *postimage,\n-\t\t\t\t    unsigned long try,\n-\t\t\t\t    int try_lno,\n+\t\t\t\t    unsigned long current,\n+\t\t\t\t    int current_lno,\n \t\t\t\t    int preimage_limit)\n {\n \tint i;\n@@ -2404,9 +2404,9 @@ static int line_by_line_fuzzy_match(struct image *img,\n \n \tfor (i = 0; i < preimage_limit; i++) {\n \t\tsize_t prelen = preimage->line[i].len;\n-\t\tsize_t imglen = img->line[try_lno+i].len;\n+\t\tsize_t imglen = img->line[current_lno+i].len;\n \n-\t\tif (!fuzzy_matchlines(img->buf + try + imgoff, imglen,\n+\t\tif (!fuzzy_matchlines(img->buf + current + imgoff, imglen,\n \t\t\t\t      preimage->buf + preoff, prelen))\n \t\t\treturn 0;\n \t\tif (preimage->line[i].flag & LINE_COMMON)\n@@ -2443,7 +2443,7 @@ static int line_by_line_fuzzy_match(struct image *img,\n \t */\n \textra_chars = preimage_end - preimage_eof;\n \tstrbuf_init(&fixed, imgoff + extra_chars);\n-\tstrbuf_add(&fixed, img->buf + try, imgoff);\n+\tstrbuf_add(&fixed, img->buf + current, imgoff);\n \tstrbuf_add(&fixed, preimage_eof, extra_chars);\n \tfixed_buf = strbuf_detach(&fixed, &fixed_len);\n \tupdate_pre_post_images(preimage, postimage,\n@@ -2455,8 +2455,8 @@ static int match_fragment(struct apply_state *state,\n \t\t\t  struct image *img,\n \t\t\t  struct image *preimage,\n \t\t\t  struct image *postimage,\n-\t\t\t  unsigned long try,\n-\t\t\t  int try_lno,\n+\t\t\t  unsigned long current,\n+\t\t\t  int current_lno,\n \t\t\t  unsigned ws_rule,\n \t\t\t  int match_beginning, int match_end)\n {\n@@ -2466,12 +2466,12 @@ static int match_fragment(struct apply_state *state,\n \tsize_t fixed_len, postlen;\n \tint preimage_limit;\n \n-\tif (preimage->nr + try_lno <= img->nr) {\n+\tif (preimage->nr + current_lno <= img->nr) {\n \t\t/*\n \t\t * The hunk falls within the boundaries of img.\n \t\t */\n \t\tpreimage_limit = preimage->nr;\n-\t\tif (match_end && (preimage->nr + try_lno != img->nr))\n+\t\tif (match_end && (preimage->nr + current_lno != img->nr))\n \t\t\treturn 0;\n \t} else if (state->ws_error_action == correct_ws_error &&\n \t\t   (ws_rule & WS_BLANK_AT_EOF)) {\n@@ -2482,7 +2482,7 @@ static int match_fragment(struct apply_state *state,\n \t\t * match with img, and the remainder of the preimage\n \t\t * must be blank.\n \t\t */\n-\t\tpreimage_limit = img->nr - try_lno;\n+\t\tpreimage_limit = img->nr - current_lno;\n \t} else {\n \t\t/*\n \t\t * The hunk extends beyond the end of the img and\n@@ -2492,27 +2492,27 @@ static int match_fragment(struct apply_state *state,\n \t\treturn 0;\n \t}\n \n-\tif (match_beginning && try_lno)\n+\tif (match_beginning && current_lno)\n \t\treturn 0;\n \n \t/* Quick hash check */\n \tfor (i = 0; i < preimage_limit; i++)\n-\t\tif ((img->line[try_lno + i].flag & LINE_PATCHED) ||\n-\t\t    (preimage->line[i].hash != img->line[try_lno + i].hash))\n+\t\tif ((img->line[current_lno + i].flag & LINE_PATCHED) ||\n+\t\t    (preimage->line[i].hash != img->line[current_lno + i].hash))\n \t\t\treturn 0;\n \n \tif (preimage_limit == preimage->nr) {\n \t\t/*\n \t\t * Do we have an exact match?  If we were told to match\n-\t\t * at the end, size must be exactly at try+fragsize,\n-\t\t * otherwise try+fragsize must be still within the preimage,\n+\t\t * at the end, size must be exactly at current+fragsize,\n+\t\t * otherwise current+fragsize must be still within the preimage,\n \t\t * and either case, the old piece should match the preimage\n \t\t * exactly.\n \t\t */\n \t\tif ((match_end\n-\t\t     ? (try + preimage->len == img->len)\n-\t\t     : (try + preimage->len <= img->len)) &&\n-\t\t    !memcmp(img->buf + try, preimage->buf, preimage->len))\n+\t\t     ? (current + preimage->len == img->len)\n+\t\t     : (current + preimage->len <= img->len)) &&\n+\t\t    !memcmp(img->buf + current, preimage->buf, preimage->len))\n \t\t\treturn 1;\n \t} else {\n \t\t/*\n@@ -2543,7 +2543,7 @@ static int match_fragment(struct apply_state *state,\n \t */\n \tif (state->ws_ignore_action == ignore_ws_change)\n \t\treturn line_by_line_fuzzy_match(img, preimage, postimage,\n-\t\t\t\t\t\ttry, try_lno, preimage_limit);\n+\t\t\t\t\t\tcurrent, current_lno, preimage_limit);\n \n \tif (state->ws_error_action != correct_ws_error)\n \t\treturn 0;\n@@ -2577,10 +2577,10 @@ static int match_fragment(struct apply_state *state,\n \t */\n \tstrbuf_init(&fixed, preimage->len + 1);\n \torig = preimage->buf;\n-\ttarget = img->buf + try;\n+\ttarget = img->buf + current;\n \tfor (i = 0; i < preimage_limit; i++) {\n \t\tsize_t oldlen = preimage->line[i].len;\n-\t\tsize_t tgtlen = img->line[try_lno + i].len;\n+\t\tsize_t tgtlen = img->line[current_lno + i].len;\n \t\tsize_t fixstart = fixed.len;\n \t\tstruct strbuf tgtfix;\n \t\tint match;\n@@ -2666,8 +2666,8 @@ static int find_pos(struct apply_state *state,\n \t\t    int match_beginning, int match_end)\n {\n \tint i;\n-\tunsigned long backwards, forwards, try;\n-\tint backwards_lno, forwards_lno, try_lno;\n+\tunsigned long backwards, forwards, current;\n+\tint backwards_lno, forwards_lno, current_lno;\n \n \t/*\n \t * If match_beginning or match_end is specified, there is no\n@@ -2687,25 +2687,25 @@ static int find_pos(struct apply_state *state,\n \tif ((size_t) line > img->nr)\n \t\tline = img->nr;\n \n-\ttry = 0;\n+\tcurrent = 0;\n \tfor (i = 0; i < line; i++)\n-\t\ttry += img->line[i].len;\n+\t\tcurrent += img->line[i].len;\n \n \t/*\n \t * There's probably some smart way to do this, but I'll leave\n \t * that to the smart and beautiful people. I'm simple and stupid.\n \t */\n-\tbackwards = try;\n+\tbackwards = current;\n \tbackwards_lno = line;\n-\tforwards = try;\n+\tforwards = current;\n \tforwards_lno = line;\n-\ttry_lno = line;\n+\tcurrent_lno = line;\n \n \tfor (i = 0; ; i++) {\n \t\tif (match_fragment(state, img, preimage, postimage,\n-\t\t\t\t   try, try_lno, ws_rule,\n+\t\t\t\t   current, current_lno, ws_rule,\n \t\t\t\t   match_beginning, match_end))\n-\t\t\treturn try_lno;\n+\t\t\treturn current_lno;\n \n \tagain:\n \t\tif (backwards_lno == 0 && forwards_lno == img->nr)\n@@ -2718,8 +2718,8 @@ static int find_pos(struct apply_state *state,\n \t\t\t}\n \t\t\tbackwards_lno--;\n \t\t\tbackwards -= img->line[backwards_lno].len;\n-\t\t\ttry = backwards;\n-\t\t\ttry_lno = backwards_lno;\n+\t\t\tcurrent = backwards;\n+\t\t\tcurrent_lno = backwards_lno;\n \t\t} else {\n \t\t\tif (forwards_lno == img->nr) {\n \t\t\t\ti++;\n@@ -2727,8 +2727,8 @@ static int find_pos(struct apply_state *state,\n \t\t\t}\n \t\t\tforwards += img->line[forwards_lno].len;\n \t\t\tforwards_lno++;\n-\t\t\ttry = forwards;\n-\t\t\ttry_lno = forwards_lno;\n+\t\t\tcurrent = forwards;\n+\t\t\tcurrent_lno = forwards_lno;\n \t\t}\n \n \t}\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337720","messageId":"20180129223728.30569-10-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 09/37] checkout: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:00Z","receivedAt":"2018-01-29T22:38:13Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/checkout.c | 138 ++++++++++++++++++++++++++---------------------------\n 1 file changed, 69 insertions(+), 69 deletions(-)\n\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex c54c78df5..30f09ec50 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -54,14 +54,14 @@ struct checkout_opts {\n \tstruct tree *source_tree;\n };\n \n-static int post_checkout_hook(struct commit *old, struct commit *new,\n+static int post_checkout_hook(struct commit *old, struct commit *new_commit,\n \t\t\t      int changed)\n {\n \treturn run_hook_le(NULL, \"post-checkout\",\n \t\t\t   oid_to_hex(old ? &old->object.oid : &null_oid),\n-\t\t\t   oid_to_hex(new ? &new->object.oid : &null_oid),\n+\t\t\t   oid_to_hex(new_commit ? &new_commit->object.oid : &null_oid),\n \t\t\t   changed ? \"1\" : \"0\", NULL);\n-\t/* \"new\" can be NULL when checking out from the index before\n+\t/* \"new_commit\" can be NULL when checking out from the index before\n \t   a commit exists. */\n \n }\n@@ -473,7 +473,7 @@ static void setup_branch_path(struct branch_info *branch)\n \n static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\t      struct branch_info *old,\n-\t\t\t      struct branch_info *new,\n+\t\t\t      struct branch_info *new_branch_info,\n \t\t\t      int *writeout_error)\n {\n \tint ret;\n@@ -485,7 +485,7 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \n \tresolve_undo_clear();\n \tif (opts->force) {\n-\t\tret = reset_tree(new->commit->tree, opts, 1, writeout_error);\n+\t\tret = reset_tree(new_branch_info->commit->tree, opts, 1, writeout_error);\n \t\tif (ret)\n \t\t\treturn ret;\n \t} else {\n@@ -523,7 +523,7 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\t\t\t   &old->commit->object.oid :\n \t\t\t\t\t   the_hash_algo->empty_tree);\n \t\tinit_tree_desc(&trees[0], tree->buffer, tree->size);\n-\t\ttree = parse_tree_indirect(&new->commit->object.oid);\n+\t\ttree = parse_tree_indirect(&new_branch_info->commit->object.oid);\n \t\tinit_tree_desc(&trees[1], tree->buffer, tree->size);\n \n \t\tret = unpack_trees(2, trees, &topts);\n@@ -571,18 +571,18 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\to.verbosity = 0;\n \t\t\twork = write_tree_from_memory(&o);\n \n-\t\t\tret = reset_tree(new->commit->tree, opts, 1,\n+\t\t\tret = reset_tree(new_branch_info->commit->tree, opts, 1,\n \t\t\t\t\t writeout_error);\n \t\t\tif (ret)\n \t\t\t\treturn ret;\n \t\t\to.ancestor = old->name;\n-\t\t\to.branch1 = new->name;\n+\t\t\to.branch1 = new_branch_info->name;\n \t\t\to.branch2 = \"local\";\n-\t\t\tret = merge_trees(&o, new->commit->tree, work,\n+\t\t\tret = merge_trees(&o, new_branch_info->commit->tree, work,\n \t\t\t\told->commit->tree, &result);\n \t\t\tif (ret < 0)\n \t\t\t\texit(128);\n-\t\t\tret = reset_tree(new->commit->tree, opts, 0,\n+\t\t\tret = reset_tree(new_branch_info->commit->tree, opts, 0,\n \t\t\t\t\t writeout_error);\n \t\t\tstrbuf_release(&o.obuf);\n \t\t\tif (ret)\n@@ -600,15 +600,15 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\tdie(_(\"unable to write new index file\"));\n \n \tif (!opts->force && !opts->quiet)\n-\t\tshow_local_changes(&new->commit->object, &opts->diff_options);\n+\t\tshow_local_changes(&new_branch_info->commit->object, &opts->diff_options);\n \n \treturn 0;\n }\n \n-static void report_tracking(struct branch_info *new)\n+static void report_tracking(struct branch_info *new_branch_info)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n-\tstruct branch *branch = branch_get(new->name);\n+\tstruct branch *branch = branch_get(new_branch_info->name);\n \n \tif (!format_tracking_info(branch, &sb))\n \t\treturn;\n@@ -618,7 +618,7 @@ static void report_tracking(struct branch_info *new)\n \n static void update_refs_for_switch(const struct checkout_opts *opts,\n \t\t\t\t   struct branch_info *old,\n-\t\t\t\t   struct branch_info *new)\n+\t\t\t\t   struct branch_info *new_branch_info)\n {\n \tstruct strbuf msg = STRBUF_INIT;\n \tconst char *old_desc, *reflog_msg;\n@@ -645,14 +645,14 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \t\t\tfree(refname);\n \t\t}\n \t\telse\n-\t\t\tcreate_branch(opts->new_branch, new->name,\n+\t\t\tcreate_branch(opts->new_branch, new_branch_info->name,\n \t\t\t\t      opts->new_branch_force ? 1 : 0,\n \t\t\t\t      opts->new_branch_force ? 1 : 0,\n \t\t\t\t      opts->new_branch_log,\n \t\t\t\t      opts->quiet,\n \t\t\t\t      opts->track);\n-\t\tnew->name = opts->new_branch;\n-\t\tsetup_branch_path(new);\n+\t\tnew_branch_info->name = opts->new_branch;\n+\t\tsetup_branch_path(new_branch_info);\n \t}\n \n \told_desc = old->name;\n@@ -662,40 +662,40 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \treflog_msg = getenv(\"GIT_REFLOG_ACTION\");\n \tif (!reflog_msg)\n \t\tstrbuf_addf(&msg, \"checkout: moving from %s to %s\",\n-\t\t\told_desc ? old_desc : \"(invalid)\", new->name);\n+\t\t\told_desc ? old_desc : \"(invalid)\", new_branch_info->name);\n \telse\n \t\tstrbuf_insert(&msg, 0, reflog_msg, strlen(reflog_msg));\n \n-\tif (!strcmp(new->name, \"HEAD\") && !new->path && !opts->force_detach) {\n+\tif (!strcmp(new_branch_info->name, \"HEAD\") && !new_branch_info->path && !opts->force_detach) {\n \t\t/* Nothing to do. */\n-\t} else if (opts->force_detach || !new->path) {\t/* No longer on any branch. */\n-\t\tupdate_ref(msg.buf, \"HEAD\", &new->commit->object.oid, NULL,\n+\t} else if (opts->force_detach || !new_branch_info->path) {\t/* No longer on any branch. */\n+\t\tupdate_ref(msg.buf, \"HEAD\", &new_branch_info->commit->object.oid, NULL,\n \t\t\t   REF_NO_DEREF, UPDATE_REFS_DIE_ON_ERR);\n \t\tif (!opts->quiet) {\n \t\t\tif (old->path &&\n \t\t\t    advice_detached_head && !opts->force_detach)\n-\t\t\t\tdetach_advice(new->name);\n-\t\t\tdescribe_detached_head(_(\"HEAD is now at\"), new->commit);\n+\t\t\t\tdetach_advice(new_branch_info->name);\n+\t\t\tdescribe_detached_head(_(\"HEAD is now at\"), new_branch_info->commit);\n \t\t}\n-\t} else if (new->path) {\t/* Switch branches. */\n-\t\tif (create_symref(\"HEAD\", new->path, msg.buf) < 0)\n+\t} else if (new_branch_info->path) {\t/* Switch branches. */\n+\t\tif (create_symref(\"HEAD\", new_branch_info->path, msg.buf) < 0)\n \t\t\tdie(_(\"unable to update HEAD\"));\n \t\tif (!opts->quiet) {\n-\t\t\tif (old->path && !strcmp(new->path, old->path)) {\n+\t\t\tif (old->path && !strcmp(new_branch_info->path, old->path)) {\n \t\t\t\tif (opts->new_branch_force)\n \t\t\t\t\tfprintf(stderr, _(\"Reset branch '%s'\\n\"),\n-\t\t\t\t\t\tnew->name);\n+\t\t\t\t\t\tnew_branch_info->name);\n \t\t\t\telse\n \t\t\t\t\tfprintf(stderr, _(\"Already on '%s'\\n\"),\n-\t\t\t\t\t\tnew->name);\n+\t\t\t\t\t\tnew_branch_info->name);\n \t\t\t} else if (opts->new_branch) {\n \t\t\t\tif (opts->branch_exists)\n-\t\t\t\t\tfprintf(stderr, _(\"Switched to and reset branch '%s'\\n\"), new->name);\n+\t\t\t\t\tfprintf(stderr, _(\"Switched to and reset branch '%s'\\n\"), new_branch_info->name);\n \t\t\t\telse\n-\t\t\t\t\tfprintf(stderr, _(\"Switched to a new branch '%s'\\n\"), new->name);\n+\t\t\t\t\tfprintf(stderr, _(\"Switched to a new branch '%s'\\n\"), new_branch_info->name);\n \t\t\t} else {\n \t\t\t\tfprintf(stderr, _(\"Switched to branch '%s'\\n\"),\n-\t\t\t\t\tnew->name);\n+\t\t\t\t\tnew_branch_info->name);\n \t\t\t}\n \t\t}\n \t\tif (old->path && old->name) {\n@@ -706,8 +706,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \tremove_branch_state();\n \tstrbuf_release(&msg);\n \tif (!opts->quiet &&\n-\t    (new->path || (!opts->force_detach && !strcmp(new->name, \"HEAD\"))))\n-\t\treport_tracking(new);\n+\t    (new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, \"HEAD\"))))\n+\t\treport_tracking(new_branch_info);\n }\n \n static int add_pending_uninteresting_ref(const char *refname,\n@@ -787,7 +787,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)\n  * HEAD.  If it is not reachable from any ref, this is the last chance\n  * for the user to do so without resorting to reflog.\n  */\n-static void orphaned_commit_warning(struct commit *old, struct commit *new)\n+static void orphaned_commit_warning(struct commit *old, struct commit *new_commit)\n {\n \tstruct rev_info revs;\n \tstruct object *object = &old->object;\n@@ -799,7 +799,7 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)\n \tadd_pending_object(&revs, object, oid_to_hex(&object->oid));\n \n \tfor_each_ref(add_pending_uninteresting_ref, &revs);\n-\tadd_pending_oid(&revs, \"HEAD\", &new->object.oid, UNINTERESTING);\n+\tadd_pending_oid(&revs, \"HEAD\", &new_commit->object.oid, UNINTERESTING);\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(_(\"internal error in revision walk\"));\n@@ -813,7 +813,7 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)\n }\n \n static int switch_branches(const struct checkout_opts *opts,\n-\t\t\t   struct branch_info *new)\n+\t\t\t   struct branch_info *new_branch_info)\n {\n \tint ret = 0;\n \tstruct branch_info old;\n@@ -830,26 +830,26 @@ static int switch_branches(const struct checkout_opts *opts,\n \tif (old.path)\n \t\tskip_prefix(old.path, \"refs/heads/\", &old.name);\n \n-\tif (!new->name) {\n-\t\tnew->name = \"HEAD\";\n-\t\tnew->commit = old.commit;\n-\t\tif (!new->commit)\n+\tif (!new_branch_info->name) {\n+\t\tnew_branch_info->name = \"HEAD\";\n+\t\tnew_branch_info->commit = old.commit;\n+\t\tif (!new_branch_info->commit)\n \t\t\tdie(_(\"You are on a branch yet to be born\"));\n-\t\tparse_commit_or_die(new->commit);\n+\t\tparse_commit_or_die(new_branch_info->commit);\n \t}\n \n-\tret = merge_working_tree(opts, &old, new, &writeout_error);\n+\tret = merge_working_tree(opts, &old, new_branch_info, &writeout_error);\n \tif (ret) {\n \t\tfree(path_to_free);\n \t\treturn ret;\n \t}\n \n-\tif (!opts->quiet && !old.path && old.commit && new->commit != old.commit)\n-\t\torphaned_commit_warning(old.commit, new->commit);\n+\tif (!opts->quiet && !old.path && old.commit && new_branch_info->commit != old.commit)\n+\t\torphaned_commit_warning(old.commit, new_branch_info->commit);\n \n-\tupdate_refs_for_switch(opts, &old, new);\n+\tupdate_refs_for_switch(opts, &old, new_branch_info);\n \n-\tret = post_checkout_hook(old.commit, new->commit, 1);\n+\tret = post_checkout_hook(old.commit, new_branch_info->commit, 1);\n \tfree(path_to_free);\n \treturn ret || writeout_error;\n }\n@@ -870,7 +870,7 @@ static int git_checkout_config(const char *var, const char *value, void *cb)\n \n static int parse_branchname_arg(int argc, const char **argv,\n \t\t\t\tint dwim_new_local_branch_ok,\n-\t\t\t\tstruct branch_info *new,\n+\t\t\t\tstruct branch_info *new_branch_info,\n \t\t\t\tstruct checkout_opts *opts,\n \t\t\t\tstruct object_id *rev)\n {\n@@ -988,22 +988,22 @@ static int parse_branchname_arg(int argc, const char **argv,\n \targv++;\n \targc--;\n \n-\tnew->name = arg;\n-\tsetup_branch_path(new);\n+\tnew_branch_info->name = arg;\n+\tsetup_branch_path(new_branch_info);\n \n-\tif (!check_refname_format(new->path, 0) &&\n-\t    !read_ref(new->path, &branch_rev))\n+\tif (!check_refname_format(new_branch_info->path, 0) &&\n+\t    !read_ref(new_branch_info->path, &branch_rev))\n \t\toidcpy(rev, &branch_rev);\n \telse\n-\t\tnew->path = NULL; /* not an existing branch */\n+\t\tnew_branch_info->path = NULL; /* not an existing branch */\n \n-\tnew->commit = lookup_commit_reference_gently(rev, 1);\n-\tif (!new->commit) {\n+\tnew_branch_info->commit = lookup_commit_reference_gently(rev, 1);\n+\tif (!new_branch_info->commit) {\n \t\t/* not a commit */\n \t\t*source_tree = parse_tree_indirect(rev);\n \t} else {\n-\t\tparse_commit_or_die(new->commit);\n-\t\t*source_tree = new->commit->tree;\n+\t\tparse_commit_or_die(new_branch_info->commit);\n+\t\t*source_tree = new_branch_info->commit->tree;\n \t}\n \n \tif (!*source_tree)                   /* case (1): want a tree */\n@@ -1043,7 +1043,7 @@ static int switch_unborn_to_new_branch(const struct checkout_opts *opts)\n }\n \n static int checkout_branch(struct checkout_opts *opts,\n-\t\t\t   struct branch_info *new)\n+\t\t\t   struct branch_info *new_branch_info)\n {\n \tif (opts->pathspec.nr)\n \t\tdie(_(\"paths cannot be used with switching branches\"));\n@@ -1072,21 +1072,21 @@ static int checkout_branch(struct checkout_opts *opts,\n \t} else if (opts->track == BRANCH_TRACK_UNSPECIFIED)\n \t\topts->track = git_branch_track;\n \n-\tif (new->name && !new->commit)\n+\tif (new_branch_info->name && !new_branch_info->commit)\n \t\tdie(_(\"Cannot switch branch to a non-commit '%s'\"),\n-\t\t    new->name);\n+\t\t    new_branch_info->name);\n \n-\tif (new->path && !opts->force_detach && !opts->new_branch &&\n+\tif (new_branch_info->path && !opts->force_detach && !opts->new_branch &&\n \t    !opts->ignore_other_worktrees) {\n \t\tint flag;\n \t\tchar *head_ref = resolve_refdup(\"HEAD\", 0, NULL, &flag);\n \t\tif (head_ref &&\n-\t\t    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))\n-\t\t\tdie_if_checked_out(new->path, 1);\n+\t\t    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new_branch_info->path)))\n+\t\t\tdie_if_checked_out(new_branch_info->path, 1);\n \t\tfree(head_ref);\n \t}\n \n-\tif (!new->commit && opts->new_branch) {\n+\tif (!new_branch_info->commit && opts->new_branch) {\n \t\tstruct object_id rev;\n \t\tint flag;\n \n@@ -1094,13 +1094,13 @@ static int checkout_branch(struct checkout_opts *opts,\n \t\t    (flag & REF_ISSYMREF) && is_null_oid(&rev))\n \t\t\treturn switch_unborn_to_new_branch(opts);\n \t}\n-\treturn switch_branches(opts, new);\n+\treturn switch_branches(opts, new_branch_info);\n }\n \n int cmd_checkout(int argc, const char **argv, const char *prefix)\n {\n \tstruct checkout_opts opts;\n-\tstruct branch_info new;\n+\tstruct branch_info new_branch_info;\n \tchar *conflict_style = NULL;\n \tint dwim_new_local_branch = 1;\n \tstruct option options[] = {\n@@ -1138,7 +1138,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t};\n \n \tmemset(&opts, 0, sizeof(opts));\n-\tmemset(&new, 0, sizeof(new));\n+\tmemset(&new_branch_info, 0, sizeof(new_branch_info));\n \topts.overwrite_ignore = 1;\n \topts.prefix = prefix;\n \topts.show_progress = -1;\n@@ -1210,7 +1210,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t\t\topts.track == BRANCH_TRACK_UNSPECIFIED &&\n \t\t\t!opts.new_branch;\n \t\tint n = parse_branchname_arg(argc, argv, dwim_ok,\n-\t\t\t\t\t     &new, &opts, &rev);\n+\t\t\t\t\t     &new_branch_info, &opts, &rev);\n \t\targv += n;\n \t\targc -= n;\n \t}\n@@ -1253,7 +1253,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \n \tUNLEAK(opts);\n \tif (opts.patch_mode || opts.pathspec.nr)\n-\t\treturn checkout_paths(&opts, new.name);\n+\t\treturn checkout_paths(&opts, new_branch_info.name);\n \telse\n-\t\treturn checkout_branch(&opts, &new);\n+\t\treturn checkout_branch(&opts, &new_branch_info);\n }\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337721","messageId":"20180129223728.30569-15-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 14/37] combine-diff: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:05Z","receivedAt":"2018-01-29T22:38:24Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n combine-diff.c | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex bc08c4c5b..14db48966 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -162,7 +162,7 @@ enum coalesce_direction { MATCH, BASE, NEW };\n \n /* Coalesce new lines into base by finding LCS */\n static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n-\t\t\t\t    struct lline *new, int lennew,\n+\t\t\t\t    struct lline *newline, int lennew,\n \t\t\t\t    unsigned long parent, long flags)\n {\n \tint **lcs;\n@@ -170,12 +170,12 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \tstruct lline *baseend, *newend = NULL;\n \tint i, j, origbaselen = *lenbase;\n \n-\tif (new == NULL)\n+\tif (newline == NULL)\n \t\treturn base;\n \n \tif (base == NULL) {\n \t\t*lenbase = lennew;\n-\t\treturn new;\n+\t\treturn newline;\n \t}\n \n \t/*\n@@ -200,7 +200,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \t\tdirections[0][j] = NEW;\n \n \tfor (i = 1, baseend = base; i < origbaselen + 1; i++) {\n-\t\tfor (j = 1, newend = new; j < lennew + 1; j++) {\n+\t\tfor (j = 1, newend = newline; j < lennew + 1; j++) {\n \t\t\tif (match_string_spaces(baseend->line, baseend->len,\n \t\t\t\t\t\tnewend->line, newend->len, flags)) {\n \t\t\t\tlcs[i][j] = lcs[i - 1][j - 1] + 1;\n@@ -241,7 +241,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \t\t\tif (lline->prev)\n \t\t\t\tlline->prev->next = lline->next;\n \t\t\telse\n-\t\t\t\tnew = lline->next;\n+\t\t\t\tnewline = lline->next;\n \t\t\tif (lline->next)\n \t\t\t\tlline->next->prev = lline->prev;\n \n@@ -270,7 +270,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \t\t}\n \t}\n \n-\tnewend = new;\n+\tnewend = newline;\n \twhile (newend) {\n \t\tstruct lline *lline = newend;\n \t\tnewend = newend->next;\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337722","messageId":"20180129223728.30569-18-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 17/37] diff: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:08Z","receivedAt":"2018-01-29T22:38:26Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff.c | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex d682d0d1f..d49732b3b 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1504,7 +1504,7 @@ struct diff_words_style_elem {\n \n struct diff_words_style {\n \tenum diff_words_type type;\n-\tstruct diff_words_style_elem new, old, ctx;\n+\tstruct diff_words_style_elem new_word, old, ctx;\n \tconst char *newline;\n };\n \n@@ -1660,7 +1660,7 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)\n \t}\n \tif (plus_begin != plus_end) {\n \t\tfn_out_diff_words_write_helper(diff_words->opt,\n-\t\t\t\t&style->new, style->newline,\n+\t\t\t\t&style->new_word, style->newline,\n \t\t\t\tplus_end - plus_begin, plus_begin);\n \t}\n \n@@ -1884,7 +1884,7 @@ static void init_diff_words_data(struct emit_callback *ecbdata,\n \tif (want_color(o->use_color)) {\n \t\tstruct diff_words_style *st = ecbdata->diff_words->style;\n \t\tst->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);\n-\t\tst->new.color = diff_get_color_opt(o, DIFF_FILE_NEW);\n+\t\tst->new_word.color = diff_get_color_opt(o, DIFF_FILE_NEW);\n \t\tst->ctx.color = diff_get_color_opt(o, DIFF_CONTEXT);\n \t}\n }\n@@ -2048,7 +2048,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)\n static char *pprint_rename(const char *a, const char *b)\n {\n \tconst char *old = a;\n-\tconst char *new = b;\n+\tconst char *new_name = b;\n \tstruct strbuf name = STRBUF_INIT;\n \tint pfx_length, sfx_length;\n \tint pfx_adjust_for_slash;\n@@ -2067,16 +2067,16 @@ static char *pprint_rename(const char *a, const char *b)\n \n \t/* Find common prefix */\n \tpfx_length = 0;\n-\twhile (*old && *new && *old == *new) {\n+\twhile (*old && *new_name && *old == *new_name) {\n \t\tif (*old == '/')\n \t\t\tpfx_length = old - a + 1;\n \t\told++;\n-\t\tnew++;\n+\t\tnew_name++;\n \t}\n \n \t/* Find common suffix */\n \told = a + len_a;\n-\tnew = b + len_b;\n+\tnew_name = b + len_b;\n \tsfx_length = 0;\n \t/*\n \t * If there is a common prefix, it must end in a slash.  In\n@@ -2088,12 +2088,12 @@ static char *pprint_rename(const char *a, const char *b)\n \t */\n \tpfx_adjust_for_slash = (pfx_length ? 1 : 0);\n \twhile (a + pfx_length - pfx_adjust_for_slash <= old &&\n-\t       b + pfx_length - pfx_adjust_for_slash <= new &&\n-\t       *old == *new) {\n+\t       b + pfx_length - pfx_adjust_for_slash <= new_name &&\n+\t       *old == *new_name) {\n \t\tif (*old == '/')\n \t\t\tsfx_length = len_a - (old - a);\n \t\told--;\n-\t\tnew--;\n+\t\tnew_name--;\n \t}\n \n \t/*\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337723","messageId":"20180129223728.30569-19-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 18/37] diffcore-delta: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:09Z","receivedAt":"2018-01-29T22:38:29Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diffcore-delta.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/diffcore-delta.c b/diffcore-delta.c\nindex ebe70fb06..c83d45a04 100644\n--- a/diffcore-delta.c\n+++ b/diffcore-delta.c\n@@ -48,16 +48,16 @@ struct spanhash_top {\n \n static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)\n {\n-\tstruct spanhash_top *new;\n+\tstruct spanhash_top *new_spanhash;\n \tint i;\n \tint osz = 1 << orig->alloc_log2;\n \tint sz = osz << 1;\n \n-\tnew = xmalloc(st_add(sizeof(*orig),\n+\tnew_spanhash = xmalloc(st_add(sizeof(*orig),\n \t\t\t     st_mult(sizeof(struct spanhash), sz)));\n-\tnew->alloc_log2 = orig->alloc_log2 + 1;\n-\tnew->free = INITIAL_FREE(new->alloc_log2);\n-\tmemset(new->data, 0, sizeof(struct spanhash) * sz);\n+\tnew_spanhash->alloc_log2 = orig->alloc_log2 + 1;\n+\tnew_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);\n+\tmemset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);\n \tfor (i = 0; i < osz; i++) {\n \t\tstruct spanhash *o = &(orig->data[i]);\n \t\tint bucket;\n@@ -65,11 +65,11 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)\n \t\t\tcontinue;\n \t\tbucket = o->hashval & (sz - 1);\n \t\twhile (1) {\n-\t\t\tstruct spanhash *h = &(new->data[bucket++]);\n+\t\t\tstruct spanhash *h = &(new_spanhash->data[bucket++]);\n \t\t\tif (!h->cnt) {\n \t\t\t\th->hashval = o->hashval;\n \t\t\t\th->cnt = o->cnt;\n-\t\t\t\tnew->free--;\n+\t\t\t\tnew_spanhash->free--;\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\tif (sz <= bucket)\n@@ -77,7 +77,7 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)\n \t\t}\n \t}\n \tfree(orig);\n-\treturn new;\n+\treturn new_spanhash;\n }\n \n static struct spanhash_top *add_spanhash(struct spanhash_top *top,\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337724","messageId":"20180129223728.30569-20-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 19/37] entry: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:10Z","receivedAt":"2018-01-29T22:38:31Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n entry.c | 40 ++++++++++++++++++++--------------------\n 1 file changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/entry.c b/entry.c\nindex 30211447a..6c33112ae 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -85,12 +85,12 @@ static int create_file(const char *path, unsigned int mode)\n static void *read_blob_entry(const struct cache_entry *ce, unsigned long *size)\n {\n \tenum object_type type;\n-\tvoid *new = read_sha1_file(ce->oid.hash, &type, size);\n+\tvoid *blob_data = read_sha1_file(ce->oid.hash, &type, size);\n \n-\tif (new) {\n+\tif (blob_data) {\n \t\tif (type == OBJ_BLOB)\n-\t\t\treturn new;\n-\t\tfree(new);\n+\t\t\treturn blob_data;\n+\t\tfree(blob_data);\n \t}\n \treturn NULL;\n }\n@@ -256,7 +256,7 @@ static int write_entry(struct cache_entry *ce,\n \tunsigned int ce_mode_s_ifmt = ce->ce_mode & S_IFMT;\n \tstruct delayed_checkout *dco = state->delayed_checkout;\n \tint fd, ret, fstat_done = 0;\n-\tchar *new;\n+\tchar *new_blob;\n \tstruct strbuf buf = STRBUF_INIT;\n \tunsigned long size;\n \tssize_t wrote;\n@@ -276,8 +276,8 @@ static int write_entry(struct cache_entry *ce,\n \n \tswitch (ce_mode_s_ifmt) {\n \tcase S_IFLNK:\n-\t\tnew = read_blob_entry(ce, &size);\n-\t\tif (!new)\n+\t\tnew_blob = read_blob_entry(ce, &size);\n+\t\tif (!new_blob)\n \t\t\treturn error(\"unable to read sha1 file of %s (%s)\",\n \t\t\t\t     path, oid_to_hex(&ce->oid));\n \n@@ -288,8 +288,8 @@ static int write_entry(struct cache_entry *ce,\n \t\tif (!has_symlinks || to_tempfile)\n \t\t\tgoto write_file_entry;\n \n-\t\tret = symlink(new, path);\n-\t\tfree(new);\n+\t\tret = symlink(new_blob, path);\n+\t\tfree(new_blob);\n \t\tif (ret)\n \t\t\treturn error_errno(\"unable to create symlink %s\", path);\n \t\tbreak;\n@@ -300,11 +300,11 @@ static int write_entry(struct cache_entry *ce,\n \t\t * bother reading it at all.\n \t\t */\n \t\tif (dco && dco->state == CE_RETRY) {\n-\t\t\tnew = NULL;\n+\t\t\tnew_blob = NULL;\n \t\t\tsize = 0;\n \t\t} else {\n-\t\t\tnew = read_blob_entry(ce, &size);\n-\t\t\tif (!new)\n+\t\t\tnew_blob = read_blob_entry(ce, &size);\n+\t\t\tif (!new_blob)\n \t\t\t\treturn error(\"unable to read sha1 file of %s (%s)\",\n \t\t\t\t\t     path, oid_to_hex(&ce->oid));\n \t\t}\n@@ -313,18 +313,18 @@ static int write_entry(struct cache_entry *ce,\n \t\t * Convert from git internal format to working tree format\n \t\t */\n \t\tif (dco && dco->state != CE_NO_DELAY) {\n-\t\t\tret = async_convert_to_working_tree(ce->name, new,\n+\t\t\tret = async_convert_to_working_tree(ce->name, new_blob,\n \t\t\t\t\t\t\t    size, &buf, dco);\n \t\t\tif (ret && string_list_has_string(&dco->paths, ce->name)) {\n-\t\t\t\tfree(new);\n+\t\t\t\tfree(new_blob);\n \t\t\t\tgoto delayed;\n \t\t\t}\n \t\t} else\n-\t\t\tret = convert_to_working_tree(ce->name, new, size, &buf);\n+\t\t\tret = convert_to_working_tree(ce->name, new_blob, size, &buf);\n \n \t\tif (ret) {\n-\t\t\tfree(new);\n-\t\t\tnew = strbuf_detach(&buf, &newsize);\n+\t\t\tfree(new_blob);\n+\t\t\tnew_blob = strbuf_detach(&buf, &newsize);\n \t\t\tsize = newsize;\n \t\t}\n \t\t/*\n@@ -336,15 +336,15 @@ static int write_entry(struct cache_entry *ce,\n \twrite_file_entry:\n \t\tfd = open_output_fd(path, ce, to_tempfile);\n \t\tif (fd < 0) {\n-\t\t\tfree(new);\n+\t\t\tfree(new_blob);\n \t\t\treturn error_errno(\"unable to create file %s\", path);\n \t\t}\n \n-\t\twrote = write_in_full(fd, new, size);\n+\t\twrote = write_in_full(fd, new_blob, size);\n \t\tif (!to_tempfile)\n \t\t\tfstat_done = fstat_output(fd, state, &st);\n \t\tclose(fd);\n-\t\tfree(new);\n+\t\tfree(new_blob);\n \t\tif (wrote < 0)\n \t\t\treturn error(\"unable to write file %s\", path);\n \t\tbreak;\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337725","messageId":"20180129223728.30569-24-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 23/37] read-cache: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:14Z","receivedAt":"2018-01-29T22:38:41Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n read-cache.c | 36 ++++++++++++++++++------------------\n 1 file changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex 2eb81a66b..21b859087 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -70,20 +70,20 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache\n \n void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)\n {\n-\tstruct cache_entry *old = istate->cache[nr], *new;\n+\tstruct cache_entry *old = istate->cache[nr], *new_entry;\n \tint namelen = strlen(new_name);\n \n-\tnew = xmalloc(cache_entry_size(namelen));\n-\tcopy_cache_entry(new, old);\n-\tnew->ce_flags &= ~CE_HASHED;\n-\tnew->ce_namelen = namelen;\n-\tnew->index = 0;\n-\tmemcpy(new->name, new_name, namelen + 1);\n+\tnew_entry = xmalloc(cache_entry_size(namelen));\n+\tcopy_cache_entry(new_entry, old);\n+\tnew_entry->ce_flags &= ~CE_HASHED;\n+\tnew_entry->ce_namelen = namelen;\n+\tnew_entry->index = 0;\n+\tmemcpy(new_entry->name, new_name, namelen + 1);\n \n \tcache_tree_invalidate_path(istate, old->name);\n \tuntracked_cache_remove_from_index(istate, old->name);\n \tremove_index_entry_at(istate, nr);\n-\tadd_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);\n+\tadd_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);\n }\n \n void fill_stat_data(struct stat_data *sd, struct stat *st)\n@@ -615,18 +615,18 @@ static struct cache_entry *create_alias_ce(struct index_state *istate,\n \t\t\t\t\t   struct cache_entry *alias)\n {\n \tint len;\n-\tstruct cache_entry *new;\n+\tstruct cache_entry *new_entry;\n \n \tif (alias->ce_flags & CE_ADDED)\n \t\tdie(\"Will not add file alias '%s' ('%s' already exists in index)\", ce->name, alias->name);\n \n \t/* Ok, create the new entry using the name of the existing alias */\n \tlen = ce_namelen(alias);\n-\tnew = xcalloc(1, cache_entry_size(len));\n-\tmemcpy(new->name, alias->name, len);\n-\tcopy_cache_entry(new, ce);\n+\tnew_entry = xcalloc(1, cache_entry_size(len));\n+\tmemcpy(new_entry->name, alias->name, len);\n+\tcopy_cache_entry(new_entry, ce);\n \tsave_or_free_index_entry(istate, ce);\n-\treturn new;\n+\treturn new_entry;\n }\n \n void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)\n@@ -1379,7 +1379,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,\n \tadded_fmt = (in_porcelain ? \"A\\t%s\\n\" : \"%s needs update\\n\");\n \tunmerged_fmt = (in_porcelain ? \"U\\t%s\\n\" : \"%s: needs merge\\n\");\n \tfor (i = 0; i < istate->cache_nr; i++) {\n-\t\tstruct cache_entry *ce, *new;\n+\t\tstruct cache_entry *ce, *new_entry;\n \t\tint cache_errno = 0;\n \t\tint changed = 0;\n \t\tint filtered = 0;\n@@ -1408,10 +1408,10 @@ int refresh_index(struct index_state *istate, unsigned int flags,\n \t\tif (filtered)\n \t\t\tcontinue;\n \n-\t\tnew = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);\n-\t\tif (new == ce)\n+\t\tnew_entry = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);\n+\t\tif (new_entry == ce)\n \t\t\tcontinue;\n-\t\tif (!new) {\n+\t\tif (!new_entry) {\n \t\t\tconst char *fmt;\n \n \t\t\tif (really && cache_errno == EINVAL) {\n@@ -1440,7 +1440,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,\n \t\t\tcontinue;\n \t\t}\n \n-\t\treplace_index_entry(istate, i, new);\n+\t\treplace_index_entry(istate, i, new_entry);\n \t}\n \treturn has_errors;\n }\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337726","messageId":"20180129223728.30569-25-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 24/37] ref-filter: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:15Z","receivedAt":"2018-01-29T22:38:45Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n ref-filter.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 9dae6cfe3..99a45beb1 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -529,12 +529,12 @@ static void end_align_handler(struct ref_formatting_stack **stack)\n \n static void align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)\n {\n-\tstruct ref_formatting_stack *new;\n+\tstruct ref_formatting_stack *new_stack;\n \n \tpush_stack_element(&state->stack);\n-\tnew = state->stack;\n-\tnew->at_end = end_align_handler;\n-\tnew->at_end_data = &atomv->atom->u.align;\n+\tnew_stack = state->stack;\n+\tnew_stack->at_end = end_align_handler;\n+\tnew_stack->at_end_data = &atomv->atom->u.align;\n }\n \n static void if_then_else_handler(struct ref_formatting_stack **stack)\n@@ -574,16 +574,16 @@ static void if_then_else_handler(struct ref_formatting_stack **stack)\n \n static void if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)\n {\n-\tstruct ref_formatting_stack *new;\n+\tstruct ref_formatting_stack *new_stack;\n \tstruct if_then_else *if_then_else = xcalloc(sizeof(struct if_then_else), 1);\n \n \tif_then_else->str = atomv->atom->u.if_then_else.str;\n \tif_then_else->cmp_status = atomv->atom->u.if_then_else.cmp_status;\n \n \tpush_stack_element(&state->stack);\n-\tnew = state->stack;\n-\tnew->at_end = if_then_else_handler;\n-\tnew->at_end_data = if_then_else;\n+\tnew_stack = state->stack;\n+\tnew_stack->at_end = if_then_else_handler;\n+\tnew_stack->at_end_data = if_then_else;\n }\n \n static int is_empty(const char *s)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337727","messageId":"20180129223728.30569-27-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 26/37] split-index: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:17Z","receivedAt":"2018-01-29T22:38:47Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n split-index.c | 10 +++++-----\n split-index.h |  2 +-\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/split-index.c b/split-index.c\nindex 83e39ec8d..8ae4bee89 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -304,16 +304,16 @@ void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce\n \n void replace_index_entry_in_base(struct index_state *istate,\n \t\t\t\t struct cache_entry *old,\n-\t\t\t\t struct cache_entry *new)\n+\t\t\t\t struct cache_entry *new_entry)\n {\n \tif (old->index &&\n \t    istate->split_index &&\n \t    istate->split_index->base &&\n \t    old->index <= istate->split_index->base->cache_nr) {\n-\t\tnew->index = old->index;\n-\t\tif (old != istate->split_index->base->cache[new->index - 1])\n-\t\t\tfree(istate->split_index->base->cache[new->index - 1]);\n-\t\tistate->split_index->base->cache[new->index - 1] = new;\n+\t\tnew_entry->index = old->index;\n+\t\tif (old != istate->split_index->base->cache[new_entry->index - 1])\n+\t\t\tfree(istate->split_index->base->cache[new_entry->index - 1]);\n+\t\tistate->split_index->base->cache[new_entry->index - 1] = new_entry;\n \t}\n }\n \ndiff --git a/split-index.h b/split-index.h\nindex df91c1bda..43d66826e 100644\n--- a/split-index.h\n+++ b/split-index.h\n@@ -21,7 +21,7 @@ struct split_index *init_split_index(struct index_state *istate);\n void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce);\n void replace_index_entry_in_base(struct index_state *istate,\n \t\t\t\t struct cache_entry *old,\n-\t\t\t\t struct cache_entry *new);\n+\t\t\t\t struct cache_entry *new_entry);\n int read_link_extension(struct index_state *istate,\n \t\t\tconst void *data, unsigned long sz);\n int write_link_extension(struct strbuf *sb,\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337728","messageId":"20180129223728.30569-26-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 25/37] remote: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:16Z","receivedAt":"2018-01-29T22:38:53Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n remote.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex 4e93753e1..6f79881f6 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1970,12 +1970,12 @@ static void unmark_and_free(struct commit_list *list, unsigned int mark)\n int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)\n {\n \tstruct object *o;\n-\tstruct commit *old, *new;\n+\tstruct commit *old, *new_commit;\n \tstruct commit_list *list, *used;\n \tint found = 0;\n \n \t/*\n-\t * Both new and old must be commit-ish and new is descendant of\n+\t * Both new_commit and old must be commit-ish and new_commit is descendant of\n \t * old.  Otherwise we require --force.\n \t */\n \to = deref_tag(parse_object(old_oid), NULL, 0);\n@@ -1986,17 +1986,17 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)\n \to = deref_tag(parse_object(new_oid), NULL, 0);\n \tif (!o || o->type != OBJ_COMMIT)\n \t\treturn 0;\n-\tnew = (struct commit *) o;\n+\tnew_commit = (struct commit *) o;\n \n-\tif (parse_commit(new) < 0)\n+\tif (parse_commit(new_commit) < 0)\n \t\treturn 0;\n \n \tused = list = NULL;\n-\tcommit_list_insert(new, &list);\n+\tcommit_list_insert(new_commit, &list);\n \twhile (list) {\n-\t\tnew = pop_most_recent_commit(&list, TMP_MARK);\n-\t\tcommit_list_insert(new, &used);\n-\t\tif (new == old) {\n+\t\tnew_commit = pop_most_recent_commit(&list, TMP_MARK);\n+\t\tcommit_list_insert(new_commit, &used);\n+\t\tif (new_commit == old) {\n \t\t\tfound = 1;\n \t\t\tbreak;\n \t\t}\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337729","messageId":"20180129223728.30569-23-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 22/37] line-log: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:13Z","receivedAt":"2018-01-29T22:38:56Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n line-log.c | 48 ++++++++++++++++++++++++------------------------\n 1 file changed, 24 insertions(+), 24 deletions(-)\n\ndiff --git a/line-log.c b/line-log.c\nindex 545ad0f28..346664c3d 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -151,29 +151,29 @@ static void range_set_union(struct range_set *out,\n \n \tassert(out->nr == 0);\n \twhile (i < a->nr || j < b->nr) {\n-\t\tstruct range *new;\n+\t\tstruct range *new_range;\n \t\tif (i < a->nr && j < b->nr) {\n \t\t\tif (ra[i].start < rb[j].start)\n-\t\t\t\tnew = &ra[i++];\n+\t\t\t\tnew_range = &ra[i++];\n \t\t\telse if (ra[i].start > rb[j].start)\n-\t\t\t\tnew = &rb[j++];\n+\t\t\t\tnew_range = &rb[j++];\n \t\t\telse if (ra[i].end < rb[j].end)\n-\t\t\t\tnew = &ra[i++];\n+\t\t\t\tnew_range = &ra[i++];\n \t\t\telse\n-\t\t\t\tnew = &rb[j++];\n+\t\t\t\tnew_range = &rb[j++];\n \t\t} else if (i < a->nr)      /* b exhausted */\n-\t\t\tnew = &ra[i++];\n+\t\t\tnew_range = &ra[i++];\n \t\telse                       /* a exhausted */\n-\t\t\tnew = &rb[j++];\n-\t\tif (new->start == new->end)\n+\t\t\tnew_range = &rb[j++];\n+\t\tif (new_range->start == new_range->end)\n \t\t\t; /* empty range */\n-\t\telse if (!out->nr || out->ranges[out->nr-1].end < new->start) {\n+\t\telse if (!out->nr || out->ranges[out->nr-1].end < new_range->start) {\n \t\t\trange_set_grow(out, 1);\n-\t\t\tout->ranges[out->nr].start = new->start;\n-\t\t\tout->ranges[out->nr].end = new->end;\n+\t\t\tout->ranges[out->nr].start = new_range->start;\n+\t\t\tout->ranges[out->nr].end = new_range->end;\n \t\t\tout->nr++;\n-\t\t} else if (out->ranges[out->nr-1].end < new->end) {\n-\t\t\tout->ranges[out->nr-1].end = new->end;\n+\t\t} else if (out->ranges[out->nr-1].end < new_range->end) {\n+\t\t\tout->ranges[out->nr-1].end = new_range->end;\n \t\t}\n \t}\n }\n@@ -697,17 +697,17 @@ static void add_line_range(struct rev_info *revs, struct commit *commit,\n \t\t\t   struct line_log_data *range)\n {\n \tstruct line_log_data *old = NULL;\n-\tstruct line_log_data *new = NULL;\n+\tstruct line_log_data *new_line = NULL;\n \n \told = lookup_decoration(&revs->line_log_data, &commit->object);\n \tif (old && range) {\n-\t\tnew = line_log_data_merge(old, range);\n+\t\tnew_line = line_log_data_merge(old, range);\n \t\tfree_line_log_data(old);\n \t} else if (range)\n-\t\tnew = line_log_data_copy(range);\n+\t\tnew_line = line_log_data_copy(range);\n \n-\tif (new)\n-\t\tadd_decoration(&revs->line_log_data, &commit->object, new);\n+\tif (new_line)\n+\t\tadd_decoration(&revs->line_log_data, &commit->object, new_line);\n }\n \n static void clear_commit_line_range(struct rev_info *revs, struct commit *commit)\n@@ -1042,12 +1042,12 @@ static int process_diff_filepair(struct rev_info *rev,\n \n static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair)\n {\n-\tstruct diff_filepair *new = xmalloc(sizeof(struct diff_filepair));\n-\tnew->one = pair->one;\n-\tnew->two = pair->two;\n-\tnew->one->count++;\n-\tnew->two->count++;\n-\treturn new;\n+\tstruct diff_filepair *new_filepair = xmalloc(sizeof(struct diff_filepair));\n+\tnew_filepair->one = pair->one;\n+\tnew_filepair->two = pair->two;\n+\tnew_filepair->one->count++;\n+\tnew_filepair->two->count++;\n+\treturn new_filepair;\n }\n \n static void free_diffqueues(int n, struct diff_queue_struct *dq)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337730","messageId":"20180129223728.30569-31-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 30/37] init-db: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:21Z","receivedAt":"2018-01-29T22:38:57Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/init-db.c | 30 +++++++++++++++---------------\n 1 file changed, 15 insertions(+), 15 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex c9b7946ba..68ff4ad75 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -24,11 +24,11 @@ static int init_is_bare_repository = 0;\n static int init_shared_repository = -1;\n static const char *init_db_template_dir;\n \n-static void copy_templates_1(struct strbuf *path, struct strbuf *template,\n+static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,\n \t\t\t     DIR *dir)\n {\n \tsize_t path_baselen = path->len;\n-\tsize_t template_baselen = template->len;\n+\tsize_t template_baselen = template_path->len;\n \tstruct dirent *de;\n \n \t/* Note: if \".git/hooks\" file exists in the repository being\n@@ -44,12 +44,12 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,\n \t\tint exists = 0;\n \n \t\tstrbuf_setlen(path, path_baselen);\n-\t\tstrbuf_setlen(template, template_baselen);\n+\t\tstrbuf_setlen(template_path, template_baselen);\n \n \t\tif (de->d_name[0] == '.')\n \t\t\tcontinue;\n \t\tstrbuf_addstr(path, de->d_name);\n-\t\tstrbuf_addstr(template, de->d_name);\n+\t\tstrbuf_addstr(template_path, de->d_name);\n \t\tif (lstat(path->buf, &st_git)) {\n \t\t\tif (errno != ENOENT)\n \t\t\t\tdie_errno(_(\"cannot stat '%s'\"), path->buf);\n@@ -57,36 +57,36 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,\n \t\telse\n \t\t\texists = 1;\n \n-\t\tif (lstat(template->buf, &st_template))\n-\t\t\tdie_errno(_(\"cannot stat template '%s'\"), template->buf);\n+\t\tif (lstat(template_path->buf, &st_template))\n+\t\t\tdie_errno(_(\"cannot stat template '%s'\"), template_path->buf);\n \n \t\tif (S_ISDIR(st_template.st_mode)) {\n-\t\t\tDIR *subdir = opendir(template->buf);\n+\t\t\tDIR *subdir = opendir(template_path->buf);\n \t\t\tif (!subdir)\n-\t\t\t\tdie_errno(_(\"cannot opendir '%s'\"), template->buf);\n+\t\t\t\tdie_errno(_(\"cannot opendir '%s'\"), template_path->buf);\n \t\t\tstrbuf_addch(path, '/');\n-\t\t\tstrbuf_addch(template, '/');\n-\t\t\tcopy_templates_1(path, template, subdir);\n+\t\t\tstrbuf_addch(template_path, '/');\n+\t\t\tcopy_templates_1(path, template_path, subdir);\n \t\t\tclosedir(subdir);\n \t\t}\n \t\telse if (exists)\n \t\t\tcontinue;\n \t\telse if (S_ISLNK(st_template.st_mode)) {\n \t\t\tstruct strbuf lnk = STRBUF_INIT;\n-\t\t\tif (strbuf_readlink(&lnk, template->buf, 0) < 0)\n-\t\t\t\tdie_errno(_(\"cannot readlink '%s'\"), template->buf);\n+\t\t\tif (strbuf_readlink(&lnk, template_path->buf, 0) < 0)\n+\t\t\t\tdie_errno(_(\"cannot readlink '%s'\"), template_path->buf);\n \t\t\tif (symlink(lnk.buf, path->buf))\n \t\t\t\tdie_errno(_(\"cannot symlink '%s' '%s'\"),\n \t\t\t\t\t  lnk.buf, path->buf);\n \t\t\tstrbuf_release(&lnk);\n \t\t}\n \t\telse if (S_ISREG(st_template.st_mode)) {\n-\t\t\tif (copy_file(path->buf, template->buf, st_template.st_mode))\n+\t\t\tif (copy_file(path->buf, template_path->buf, st_template.st_mode))\n \t\t\t\tdie_errno(_(\"cannot copy '%s' to '%s'\"),\n-\t\t\t\t\t  template->buf, path->buf);\n+\t\t\t\t\t  template_path->buf, path->buf);\n \t\t}\n \t\telse\n-\t\t\terror(_(\"ignoring template %s\"), template->buf);\n+\t\t\terror(_(\"ignoring template %s\"), template_path->buf);\n \t}\n }\n \n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337731","messageId":"20180129223728.30569-32-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 31/37] environment: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:22Z","receivedAt":"2018-01-29T22:38:59Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n cache.h       |  2 +-\n environment.c | 14 +++++++-------\n 2 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 69b5a3bf8..5b8d49377 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1673,7 +1673,7 @@ struct pack_entry {\n  * usual \"XXXXXX\" trailer, and the resulting filename is written into the\n  * \"template\" buffer. Returns the open descriptor.\n  */\n-extern int odb_mkstemp(struct strbuf *template, const char *pattern);\n+extern int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);\n \n /*\n  * Create a pack .keep file named \"name\" (which should generally be the output\ndiff --git a/environment.c b/environment.c\nindex 63ac38a46..98f77ea95 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -247,7 +247,7 @@ char *get_object_directory(void)\n \treturn the_repository->objectdir;\n }\n \n-int odb_mkstemp(struct strbuf *template, const char *pattern)\n+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)\n {\n \tint fd;\n \t/*\n@@ -255,16 +255,16 @@ int odb_mkstemp(struct strbuf *template, const char *pattern)\n \t * restrictive except to remove write permission.\n \t */\n \tint mode = 0444;\n-\tgit_path_buf(template, \"objects/%s\", pattern);\n-\tfd = git_mkstemp_mode(template->buf, mode);\n+\tgit_path_buf(temp_filename, \"objects/%s\", pattern);\n+\tfd = git_mkstemp_mode(temp_filename->buf, mode);\n \tif (0 <= fd)\n \t\treturn fd;\n \n \t/* slow path */\n-\t/* some mkstemp implementations erase template on failure */\n-\tgit_path_buf(template, \"objects/%s\", pattern);\n-\tsafe_create_leading_directories(template->buf);\n-\treturn xmkstemp_mode(template->buf, mode);\n+\t/* some mkstemp implementations erase temp_filename on failure */\n+\tgit_path_buf(temp_filename, \"objects/%s\", pattern);\n+\tsafe_create_leading_directories(temp_filename->buf);\n+\treturn xmkstemp_mode(temp_filename->buf, mode);\n }\n \n int odb_pack_keep(const char *name)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337732","messageId":"20180129223728.30569-33-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 32/37] diff: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:23Z","receivedAt":"2018-01-29T22:39:04Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex d49732b3b..142a633e1 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3660,15 +3660,15 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,\n \t\t\t   int mode)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n-\tstruct strbuf template = STRBUF_INIT;\n+\tstruct strbuf tempfile = STRBUF_INIT;\n \tchar *path_dup = xstrdup(path);\n \tconst char *base = basename(path_dup);\n \n \t/* Generate \"XXXXXX_basename.ext\" */\n-\tstrbuf_addstr(&template, \"XXXXXX_\");\n-\tstrbuf_addstr(&template, base);\n+\tstrbuf_addstr(&tempfile, \"XXXXXX_\");\n+\tstrbuf_addstr(&tempfile, base);\n \n-\ttemp->tempfile = mks_tempfile_ts(template.buf, strlen(base) + 1);\n+\ttemp->tempfile = mks_tempfile_ts(tempfile.buf, strlen(base) + 1);\n \tif (!temp->tempfile)\n \t\tdie_errno(\"unable to create temp-file\");\n \tif (convert_to_working_tree(path,\n@@ -3683,7 +3683,7 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,\n \toid_to_hex_r(temp->hex, oid);\n \txsnprintf(temp->mode, sizeof(temp->mode), \"%06o\", mode);\n \tstrbuf_release(&buf);\n-\tstrbuf_release(&template);\n+\tstrbuf_release(&tempfile);\n \tfree(path_dup);\n }\n \n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337733","messageId":"20180129223728.30569-35-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 34/37] wrapper: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:25Z","receivedAt":"2018-01-29T22:39:05Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n git-compat-util.h |  4 ++--\n wrapper.c         | 40 ++++++++++++++++++++--------------------\n 2 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 68b2ad531..07e383257 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -826,8 +826,8 @@ extern ssize_t xpread(int fd, void *buf, size_t len, off_t offset);\n extern int xdup(int fd);\n extern FILE *xfopen(const char *path, const char *mode);\n extern FILE *xfdopen(int fd, const char *mode);\n-extern int xmkstemp(char *template);\n-extern int xmkstemp_mode(char *template, int mode);\n+extern int xmkstemp(char *temp_filename);\n+extern int xmkstemp_mode(char *temp_filename, int mode);\n extern char *xgetcwd(void);\n extern FILE *fopen_for_writing(const char *path);\n extern FILE *fopen_or_warn(const char *path, const char *mode);\ndiff --git a/wrapper.c b/wrapper.c\nindex d20356a77..1fd5e33ea 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -445,21 +445,21 @@ FILE *fopen_or_warn(const char *path, const char *mode)\n \treturn NULL;\n }\n \n-int xmkstemp(char *template)\n+int xmkstemp(char *filename_template)\n {\n \tint fd;\n \tchar origtemplate[PATH_MAX];\n-\tstrlcpy(origtemplate, template, sizeof(origtemplate));\n+\tstrlcpy(origtemplate, filename_template, sizeof(origtemplate));\n \n-\tfd = mkstemp(template);\n+\tfd = mkstemp(filename_template);\n \tif (fd < 0) {\n \t\tint saved_errno = errno;\n \t\tconst char *nonrelative_template;\n \n-\t\tif (strlen(template) != strlen(origtemplate))\n-\t\t\ttemplate = origtemplate;\n+\t\tif (strlen(filename_template) != strlen(origtemplate))\n+\t\t\tfilename_template = origtemplate;\n \n-\t\tnonrelative_template = absolute_path(template);\n+\t\tnonrelative_template = absolute_path(filename_template);\n \t\terrno = saved_errno;\n \t\tdie_errno(\"Unable to create temporary file '%s'\",\n \t\t\tnonrelative_template);\n@@ -481,7 +481,7 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)\n \tstatic const int num_letters = 62;\n \tuint64_t value;\n \tstruct timeval tv;\n-\tchar *template;\n+\tchar *filename_template;\n \tsize_t len;\n \tint fd, count;\n \n@@ -503,16 +503,16 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)\n \t */\n \tgettimeofday(&tv, NULL);\n \tvalue = ((size_t)(tv.tv_usec << 16)) ^ tv.tv_sec ^ getpid();\n-\ttemplate = &pattern[len - 6 - suffix_len];\n+\tfilename_template = &pattern[len - 6 - suffix_len];\n \tfor (count = 0; count < TMP_MAX; ++count) {\n \t\tuint64_t v = value;\n \t\t/* Fill in the random bits. */\n-\t\ttemplate[0] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[1] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[2] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[3] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[4] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[5] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[0] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[1] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[2] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[3] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[4] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[5] = letters[v % num_letters]; v /= num_letters;\n \n \t\tfd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);\n \t\tif (fd >= 0)\n@@ -541,21 +541,21 @@ int git_mkstemp_mode(char *pattern, int mode)\n \treturn git_mkstemps_mode(pattern, 0, mode);\n }\n \n-int xmkstemp_mode(char *template, int mode)\n+int xmkstemp_mode(char *filename_template, int mode)\n {\n \tint fd;\n \tchar origtemplate[PATH_MAX];\n-\tstrlcpy(origtemplate, template, sizeof(origtemplate));\n+\tstrlcpy(origtemplate, filename_template, sizeof(origtemplate));\n \n-\tfd = git_mkstemp_mode(template, mode);\n+\tfd = git_mkstemp_mode(filename_template, mode);\n \tif (fd < 0) {\n \t\tint saved_errno = errno;\n \t\tconst char *nonrelative_template;\n \n-\t\tif (!template[0])\n-\t\t\ttemplate = origtemplate;\n+\t\tif (!filename_template[0])\n+\t\t\tfilename_template = origtemplate;\n \n-\t\tnonrelative_template = absolute_path(template);\n+\t\tnonrelative_template = absolute_path(filename_template);\n \t\terrno = saved_errno;\n \t\tdie_errno(\"Unable to create temporary file '%s'\",\n \t\t\tnonrelative_template);\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337734","messageId":"20180129223728.30569-36-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 35/37] tempfile: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:26Z","receivedAt":"2018-01-29T22:39:09Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n tempfile.c | 12 ++++++------\n tempfile.h | 34 +++++++++++++++++-----------------\n 2 files changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/tempfile.c b/tempfile.c\nindex 5fdafdd2d..139ecd97f 100644\n--- a/tempfile.c\n+++ b/tempfile.c\n@@ -165,11 +165,11 @@ struct tempfile *register_tempfile(const char *path)\n \treturn tempfile;\n }\n \n-struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)\n+struct tempfile *mks_tempfile_sm(const char *filename_template, int suffixlen, int mode)\n {\n \tstruct tempfile *tempfile = new_tempfile();\n \n-\tstrbuf_add_absolute_path(&tempfile->filename, template);\n+\tstrbuf_add_absolute_path(&tempfile->filename, filename_template);\n \ttempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);\n \tif (tempfile->fd < 0) {\n \t\tdeactivate_tempfile(tempfile);\n@@ -179,7 +179,7 @@ struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)\n \treturn tempfile;\n }\n \n-struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)\n+struct tempfile *mks_tempfile_tsm(const char *filename_template, int suffixlen, int mode)\n {\n \tstruct tempfile *tempfile = new_tempfile();\n \tconst char *tmpdir;\n@@ -188,7 +188,7 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)\n \tif (!tmpdir)\n \t\ttmpdir = \"/tmp\";\n \n-\tstrbuf_addf(&tempfile->filename, \"%s/%s\", tmpdir, template);\n+\tstrbuf_addf(&tempfile->filename, \"%s/%s\", tmpdir, filename_template);\n \ttempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);\n \tif (tempfile->fd < 0) {\n \t\tdeactivate_tempfile(tempfile);\n@@ -198,12 +198,12 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)\n \treturn tempfile;\n }\n \n-struct tempfile *xmks_tempfile_m(const char *template, int mode)\n+struct tempfile *xmks_tempfile_m(const char *filename_template, int mode)\n {\n \tstruct tempfile *tempfile;\n \tstruct strbuf full_template = STRBUF_INIT;\n \n-\tstrbuf_add_absolute_path(&full_template, template);\n+\tstrbuf_add_absolute_path(&full_template, filename_template);\n \ttempfile = mks_tempfile_m(full_template.buf, mode);\n \tif (!tempfile)\n \t\tdie_errno(\"Unable to create temporary file '%s'\",\ndiff --git a/tempfile.h b/tempfile.h\nindex 450908b2e..8959c5f1b 100644\n--- a/tempfile.h\n+++ b/tempfile.h\n@@ -135,58 +135,58 @@ extern struct tempfile *register_tempfile(const char *path);\n  */\n \n /* See \"mks_tempfile functions\" above. */\n-extern struct tempfile *mks_tempfile_sm(const char *template,\n+extern struct tempfile *mks_tempfile_sm(const char *filename_template,\n \t\t\t\t\tint suffixlen, int mode);\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_s(const char *template,\n+static inline struct tempfile *mks_tempfile_s(const char *filename_template,\n \t\t\t\t\t      int suffixlen)\n {\n-\treturn mks_tempfile_sm(template, suffixlen, 0600);\n+\treturn mks_tempfile_sm(filename_template, suffixlen, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_m(const char *template, int mode)\n+static inline struct tempfile *mks_tempfile_m(const char *filename_template, int mode)\n {\n-\treturn mks_tempfile_sm(template, 0, mode);\n+\treturn mks_tempfile_sm(filename_template, 0, mode);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile(const char *template)\n+static inline struct tempfile *mks_tempfile(const char *filename_template)\n {\n-\treturn mks_tempfile_sm(template, 0, 0600);\n+\treturn mks_tempfile_sm(filename_template, 0, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-extern struct tempfile *mks_tempfile_tsm(const char *template,\n+extern struct tempfile *mks_tempfile_tsm(const char *filename_template,\n \t\t\t\t\t int suffixlen, int mode);\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_ts(const char *template,\n+static inline struct tempfile *mks_tempfile_ts(const char *filename_template,\n \t\t\t\t\t       int suffixlen)\n {\n-\treturn mks_tempfile_tsm(template, suffixlen, 0600);\n+\treturn mks_tempfile_tsm(filename_template, suffixlen, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_tm(const char *template, int mode)\n+static inline struct tempfile *mks_tempfile_tm(const char *filename_template, int mode)\n {\n-\treturn mks_tempfile_tsm(template, 0, mode);\n+\treturn mks_tempfile_tsm(filename_template, 0, mode);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_t(const char *template)\n+static inline struct tempfile *mks_tempfile_t(const char *filename_template)\n {\n-\treturn mks_tempfile_tsm(template, 0, 0600);\n+\treturn mks_tempfile_tsm(filename_template, 0, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-extern struct tempfile *xmks_tempfile_m(const char *template, int mode);\n+extern struct tempfile *xmks_tempfile_m(const char *filename_template, int mode);\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *xmks_tempfile(const char *template)\n+static inline struct tempfile *xmks_tempfile(const char *filename_template)\n {\n-\treturn xmks_tempfile_m(template, 0600);\n+\treturn xmks_tempfile_m(filename_template, 0600);\n }\n \n /*\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337735","messageId":"20180129223728.30569-37-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 36/37] trailer: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:27Z","receivedAt":"2018-01-29T22:39:10Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n trailer.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/trailer.c b/trailer.c\nindex 5a4a2ecf9..c508c9b75 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1000,7 +1000,7 @@ static struct tempfile *trailers_tempfile;\n static FILE *create_in_place_tempfile(const char *file)\n {\n \tstruct stat st;\n-\tstruct strbuf template = STRBUF_INIT;\n+\tstruct strbuf filename_template = STRBUF_INIT;\n \tconst char *tail;\n \tFILE *outfile;\n \n@@ -1014,11 +1014,11 @@ static FILE *create_in_place_tempfile(const char *file)\n \t/* Create temporary file in the same directory as the original */\n \ttail = strrchr(file, '/');\n \tif (tail != NULL)\n-\t\tstrbuf_add(&template, file, tail - file + 1);\n-\tstrbuf_addstr(&template, \"git-interpret-trailers-XXXXXX\");\n+\t\tstrbuf_add(&filename_template, file, tail - file + 1);\n+\tstrbuf_addstr(&filename_template, \"git-interpret-trailers-XXXXXX\");\n \n-\ttrailers_tempfile = xmks_tempfile_m(template.buf, st.st_mode);\n-\tstrbuf_release(&template);\n+\ttrailers_tempfile = xmks_tempfile_m(filename_template.buf, st.st_mode);\n+\tstrbuf_release(&filename_template);\n \toutfile = fdopen_tempfile(trailers_tempfile, \"w\");\n \tif (!outfile)\n \t\tdie_errno(_(\"could not open temporary file\"));\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337736","messageId":"20180129223728.30569-38-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 37/37] replace: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:28Z","receivedAt":"2018-01-29T22:39:14Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/replace.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 42cf4f62a..e48835b54 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -284,7 +284,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)\n {\n \tchar *tmpfile = git_pathdup(\"REPLACE_EDITOBJ\");\n \tenum object_type type;\n-\tstruct object_id old, new, prev;\n+\tstruct object_id old, new_oid, prev;\n \tstruct strbuf ref = STRBUF_INIT;\n \n \tif (get_oid(object_ref, &old) < 0)\n@@ -300,14 +300,14 @@ static int edit_and_replace(const char *object_ref, int force, int raw)\n \texport_object(&old, type, raw, tmpfile);\n \tif (launch_editor(tmpfile, NULL, NULL) < 0)\n \t\tdie(\"editing object file failed\");\n-\timport_object(&new, type, raw, tmpfile);\n+\timport_object(&new_oid, type, raw, tmpfile);\n \n \tfree(tmpfile);\n \n-\tif (!oidcmp(&old, &new))\n+\tif (!oidcmp(&old, &new_oid))\n \t\treturn error(\"new object is the same as the old one: '%s'\", oid_to_hex(&old));\n \n-\treturn replace_object_oid(object_ref, &old, \"replacement\", &new, force);\n+\treturn replace_object_oid(object_ref, &old, \"replacement\", &new_oid, force);\n }\n \n static void replace_parents(struct strbuf *buf, int argc, const char **argv)\n@@ -386,7 +386,7 @@ static void check_mergetags(struct commit *commit, int argc, const char **argv)\n \n static int create_graft(int argc, const char **argv, int force)\n {\n-\tstruct object_id old, new;\n+\tstruct object_id old, new_oid;\n \tconst char *old_ref = argv[0];\n \tstruct commit *commit;\n \tstruct strbuf buf = STRBUF_INIT;\n@@ -410,15 +410,15 @@ static int create_graft(int argc, const char **argv, int force)\n \n \tcheck_mergetags(commit, argc, argv);\n \n-\tif (write_sha1_file(buf.buf, buf.len, commit_type, new.hash))\n+\tif (write_sha1_file(buf.buf, buf.len, commit_type, new_oid.hash))\n \t\tdie(_(\"could not write replacement commit for: '%s'\"), old_ref);\n \n \tstrbuf_release(&buf);\n \n-\tif (!oidcmp(&old, &new))\n+\tif (!oidcmp(&old, &new_oid))\n \t\treturn error(\"new commit is the same as the old one: '%s'\", oid_to_hex(&old));\n \n-\treturn replace_object_oid(old_ref, &old, \"replacement\", &new, force);\n+\treturn replace_object_oid(old_ref, &old, \"replacement\", &new_oid, force);\n }\n \n int cmd_replace(int argc, const char **argv, const char *prefix)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337737","messageId":"20180129223728.30569-34-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 33/37] environment: rename 'namespace' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:24Z","receivedAt":"2018-01-29T22:39:18Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n environment.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/environment.c b/environment.c\nindex 98f77ea95..270ba98b5 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -98,7 +98,7 @@ int ignore_untracked_cache_config;\n /* This is set by setup_git_dir_gently() and/or git_default_config() */\n char *git_work_tree_cfg;\n \n-static char *namespace;\n+static char *git_namespace;\n \n static const char *super_prefix;\n \n@@ -156,8 +156,8 @@ void setup_git_env(void)\n \tfree(git_replace_ref_base);\n \tgit_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base\n \t\t\t\t\t\t\t  : \"refs/replace/\");\n-\tfree(namespace);\n-\tnamespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));\n+\tfree(git_namespace);\n+\tgit_namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));\n \tshallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);\n \tif (shallow_file)\n \t\tset_alternate_shallow_file(shallow_file, 0);\n@@ -191,9 +191,9 @@ const char *get_git_common_dir(void)\n \n const char *get_git_namespace(void)\n {\n-\tif (!namespace)\n+\tif (!git_namespace)\n \t\tBUG(\"git environment hasn't been setup\");\n-\treturn namespace;\n+\treturn git_namespace;\n }\n \n const char *strip_namespace(const char *namespaced_ref)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337738","messageId":"20180129223728.30569-28-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 27/37] submodule: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:18Z","receivedAt":"2018-01-29T22:39:21Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n submodule.c | 14 +++++++-------\n submodule.h |  2 +-\n 2 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/submodule.c b/submodule.c\nindex cd18400e8..244c3c21b 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -590,7 +590,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,\n \t\tstruct object_id *one, struct object_id *two,\n \t\tunsigned dirty_submodule)\n {\n-\tconst struct object_id *old = the_hash_algo->empty_tree, *new = the_hash_algo->empty_tree;\n+\tconst struct object_id *old = the_hash_algo->empty_tree, *new_oid = the_hash_algo->empty_tree;\n \tstruct commit *left = NULL, *right = NULL;\n \tstruct commit_list *merge_bases = NULL;\n \tstruct child_process cp = CHILD_PROCESS_INIT;\n@@ -607,7 +607,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,\n \tif (left)\n \t\told = one;\n \tif (right)\n-\t\tnew = two;\n+\t\tnew_oid = two;\n \n \tcp.git_cmd = 1;\n \tcp.dir = path;\n@@ -638,7 +638,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,\n \t * haven't yet been committed to the submodule yet.\n \t */\n \tif (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))\n-\t\targv_array_push(&cp.args, oid_to_hex(new));\n+\t\targv_array_push(&cp.args, oid_to_hex(new_oid));\n \n \tprepare_submodule_repo_env(&cp.env_array);\n \tif (start_command(&cp))\n@@ -1579,7 +1579,7 @@ static void submodule_reset_index(const char *path)\n  */\n int submodule_move_head(const char *path,\n \t\t\t const char *old,\n-\t\t\t const char *new,\n+\t\t\t const char *new_head,\n \t\t\t unsigned flags)\n {\n \tint ret = 0;\n@@ -1660,7 +1660,7 @@ int submodule_move_head(const char *path,\n \tif (!(flags & SUBMODULE_MOVE_HEAD_FORCE))\n \t\targv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);\n \n-\targv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);\n+\targv_array_push(&cp.args, new_head ? new_head : EMPTY_TREE_SHA1_HEX);\n \n \tif (run_command(&cp)) {\n \t\tret = -1;\n@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,\n \t}\n \n \tif (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {\n-\t\tif (new) {\n+\t\tif (new_head) {\n \t\t\tchild_process_init(&cp);\n \t\t\t/* also set the HEAD accordingly */\n \t\t\tcp.git_cmd = 1;\n@@ -1677,7 +1677,7 @@ int submodule_move_head(const char *path,\n \n \t\t\tprepare_submodule_repo_env(&cp.env_array);\n \t\t\targv_array_pushl(&cp.args, \"update-ref\", \"HEAD\",\n-\t\t\t\t\t \"--no-deref\", new, NULL);\n+\t\t\t\t\t \"--no-deref\", new_head, NULL);\n \n \t\t\tif (run_command(&cp)) {\n \t\t\t\tret = -1;\ndiff --git a/submodule.h b/submodule.h\nindex b9b7ef003..9589f1312 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -117,7 +117,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule);\n #define SUBMODULE_MOVE_HEAD_FORCE   (1<<1)\n extern int submodule_move_head(const char *path,\n \t\t\t       const char *old,\n-\t\t\t       const char *new,\n+\t\t\t       const char *new_head,\n \t\t\t       unsigned flags);\n \n /*\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337739","messageId":"20180129223728.30569-29-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 28/37] trailer: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:19Z","receivedAt":"2018-01-29T22:39:24Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n trailer.c | 34 +++++++++++++++++-----------------\n 1 file changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/trailer.c b/trailer.c\nindex 3ba157ed0..5a4a2ecf9 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -174,12 +174,12 @@ static void print_all(FILE *outfile, struct list_head *head,\n \n static struct trailer_item *trailer_from_arg(struct arg_item *arg_tok)\n {\n-\tstruct trailer_item *new = xcalloc(sizeof(*new), 1);\n-\tnew->token = arg_tok->token;\n-\tnew->value = arg_tok->value;\n+\tstruct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);\n+\tnew_item->token = arg_tok->token;\n+\tnew_item->value = arg_tok->value;\n \targ_tok->token = arg_tok->value = NULL;\n \tfree_arg_item(arg_tok);\n-\treturn new;\n+\treturn new_item;\n }\n \n static void add_arg_to_input_list(struct trailer_item *on_tok,\n@@ -666,30 +666,30 @@ static void parse_trailer(struct strbuf *tok, struct strbuf *val,\n static struct trailer_item *add_trailer_item(struct list_head *head, char *tok,\n \t\t\t\t\t     char *val)\n {\n-\tstruct trailer_item *new = xcalloc(sizeof(*new), 1);\n-\tnew->token = tok;\n-\tnew->value = val;\n-\tlist_add_tail(&new->list, head);\n-\treturn new;\n+\tstruct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);\n+\tnew_item->token = tok;\n+\tnew_item->value = val;\n+\tlist_add_tail(&new_item->list, head);\n+\treturn new_item;\n }\n \n static void add_arg_item(struct list_head *arg_head, char *tok, char *val,\n \t\t\t const struct conf_info *conf,\n \t\t\t const struct new_trailer_item *new_trailer_item)\n {\n-\tstruct arg_item *new = xcalloc(sizeof(*new), 1);\n-\tnew->token = tok;\n-\tnew->value = val;\n-\tduplicate_conf(&new->conf, conf);\n+\tstruct arg_item *new_item = xcalloc(sizeof(*new_item), 1);\n+\tnew_item->token = tok;\n+\tnew_item->value = val;\n+\tduplicate_conf(&new_item->conf, conf);\n \tif (new_trailer_item) {\n \t\tif (new_trailer_item->where != WHERE_DEFAULT)\n-\t\t\tnew->conf.where = new_trailer_item->where;\n+\t\t\tnew_item->conf.where = new_trailer_item->where;\n \t\tif (new_trailer_item->if_exists != EXISTS_DEFAULT)\n-\t\t\tnew->conf.if_exists = new_trailer_item->if_exists;\n+\t\t\tnew_item->conf.if_exists = new_trailer_item->if_exists;\n \t\tif (new_trailer_item->if_missing != MISSING_DEFAULT)\n-\t\t\tnew->conf.if_missing = new_trailer_item->if_missing;\n+\t\t\tnew_item->conf.if_missing = new_trailer_item->if_missing;\n \t}\n-\tlist_add_tail(&new->list, arg_head);\n+\tlist_add_tail(&new_item->list, arg_head);\n }\n \n static void process_command_line_args(struct list_head *arg_head,\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337740","messageId":"20180129223728.30569-30-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 29/37] unpack-trees: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:20Z","receivedAt":"2018-01-29T22:39:25Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n unpack-trees.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 96c3327f1..bdedabcd5 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -194,10 +194,10 @@ static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,\n static struct cache_entry *dup_entry(const struct cache_entry *ce)\n {\n \tunsigned int size = ce_size(ce);\n-\tstruct cache_entry *new = xmalloc(size);\n+\tstruct cache_entry *new_entry = xmalloc(size);\n \n-\tmemcpy(new, ce, size);\n-\treturn new;\n+\tmemcpy(new_entry, ce, size);\n+\treturn new_entry;\n }\n \n static void add_entry(struct unpack_trees_options *o,\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337741","messageId":"20180129223728.30569-22-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 21/37] imap-send: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:12Z","receivedAt":"2018-01-29T22:39:30Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n imap-send.c | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 36c7c1b4f..ffb0a6eca 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -1189,11 +1189,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f\n  */\n static void lf_to_crlf(struct strbuf *msg)\n {\n-\tchar *new;\n+\tchar *new_msg;\n \tsize_t i, j;\n \tchar lastc;\n \n-\t/* First pass: tally, in j, the size of the new string: */\n+\t/* First pass: tally, in j, the size of the new_msg string: */\n \tfor (i = j = 0, lastc = '\\0'; i < msg->len; i++) {\n \t\tif (msg->buf[i] == '\\n' && lastc != '\\r')\n \t\t\tj++; /* a CR will need to be added here */\n@@ -1201,18 +1201,18 @@ static void lf_to_crlf(struct strbuf *msg)\n \t\tj++;\n \t}\n \n-\tnew = xmallocz(j);\n+\tnew_msg = xmallocz(j);\n \n \t/*\n-\t * Second pass: write the new string.  Note that this loop is\n+\t * Second pass: write the new_msg string.  Note that this loop is\n \t * otherwise identical to the first pass.\n \t */\n \tfor (i = j = 0, lastc = '\\0'; i < msg->len; i++) {\n \t\tif (msg->buf[i] == '\\n' && lastc != '\\r')\n-\t\t\tnew[j++] = '\\r';\n-\t\tlastc = new[j++] = msg->buf[i];\n+\t\t\tnew_msg[j++] = '\\r';\n+\t\tlastc = new_msg[j++] = msg->buf[i];\n \t}\n-\tstrbuf_attach(msg, new, j, j + 1);\n+\tstrbuf_attach(msg, new_msg, j, j + 1);\n }\n \n /*\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337742","messageId":"20180129223728.30569-21-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 20/37] http: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:11Z","receivedAt":"2018-01-29T22:39:48Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n http.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 597771271..41cfa41a9 100644\n--- a/http.c\n+++ b/http.c\n@@ -1194,14 +1194,14 @@ static struct fill_chain *fill_cfg;\n \n void add_fill_function(void *data, int (*fill)(void *))\n {\n-\tstruct fill_chain *new = xmalloc(sizeof(*new));\n+\tstruct fill_chain *new_fill = xmalloc(sizeof(*new_fill));\n \tstruct fill_chain **linkp = &fill_cfg;\n-\tnew->data = data;\n-\tnew->fill = fill;\n-\tnew->next = NULL;\n+\tnew_fill->data = data;\n+\tnew_fill->fill = fill;\n+\tnew_fill->next = NULL;\n \twhile (*linkp)\n \t\tlinkp = &(*linkp)->next;\n-\t*linkp = new;\n+\t*linkp = new_fill;\n }\n \n void fill_active_slots(void)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337743","messageId":"20180129223728.30569-16-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 15/37] commit: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:06Z","receivedAt":"2018-01-29T22:40:08Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n commit.c | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex cd9ace105..874b6e510 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -861,19 +861,19 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)\n \tcommit_list_insert(in->item, &ret);\n \n \tfor (i = in->next; i; i = i->next) {\n-\t\tstruct commit_list *new = NULL, *end = NULL;\n+\t\tstruct commit_list *new_commits = NULL, *end = NULL;\n \n \t\tfor (j = ret; j; j = j->next) {\n \t\t\tstruct commit_list *bases;\n \t\t\tbases = get_merge_bases(i->item, j->item);\n-\t\t\tif (!new)\n-\t\t\t\tnew = bases;\n+\t\t\tif (!new_commits)\n+\t\t\t\tnew_commits = bases;\n \t\t\telse\n \t\t\t\tend->next = bases;\n \t\t\tfor (k = bases; k; k = k->next)\n \t\t\t\tend = k;\n \t\t}\n-\t\tret = new;\n+\t\tret = new_commits;\n \t}\n \treturn ret;\n }\n@@ -1617,11 +1617,11 @@ struct commit *get_merge_parent(const char *name)\n struct commit_list **commit_list_append(struct commit *commit,\n \t\t\t\t\tstruct commit_list **next)\n {\n-\tstruct commit_list *new = xmalloc(sizeof(struct commit_list));\n-\tnew->item = commit;\n-\t*next = new;\n-\tnew->next = NULL;\n-\treturn &new->next;\n+\tstruct commit_list *new_commit = xmalloc(sizeof(struct commit_list));\n+\tnew_commit->item = commit;\n+\t*next = new_commit;\n+\tnew_commit->next = NULL;\n+\treturn &new_commit->next;\n }\n \n const char *find_commit_header(const char *msg, const char *key, size_t *out_len)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337744","messageId":"20180129223728.30569-17-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 16/37] diff-lib: rename 'new' variable","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:07Z","receivedAt":"2018-01-29T22:40:11Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff-lib.c | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/diff-lib.c b/diff-lib.c\nindex 8104603a3..46375abb4 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -302,7 +302,7 @@ static int get_stat_data(const struct cache_entry *ce,\n }\n \n static void show_new_file(struct rev_info *revs,\n-\t\t\t  const struct cache_entry *new,\n+\t\t\t  const struct cache_entry *new_file,\n \t\t\t  int cached, int match_missing)\n {\n \tconst struct object_id *oid;\n@@ -313,16 +313,16 @@ static void show_new_file(struct rev_info *revs,\n \t * New file in the index: it might actually be different in\n \t * the working tree.\n \t */\n-\tif (get_stat_data(new, &oid, &mode, cached, match_missing,\n+\tif (get_stat_data(new_file, &oid, &mode, cached, match_missing,\n \t    &dirty_submodule, &revs->diffopt) < 0)\n \t\treturn;\n \n-\tdiff_index_show_file(revs, \"+\", new, oid, !is_null_oid(oid), mode, dirty_submodule);\n+\tdiff_index_show_file(revs, \"+\", new_file, oid, !is_null_oid(oid), mode, dirty_submodule);\n }\n \n static int show_modified(struct rev_info *revs,\n \t\t\t const struct cache_entry *old,\n-\t\t\t const struct cache_entry *new,\n+\t\t\t const struct cache_entry *new_entry,\n \t\t\t int report_missing,\n \t\t\t int cached, int match_missing)\n {\n@@ -330,7 +330,7 @@ static int show_modified(struct rev_info *revs,\n \tconst struct object_id *oid;\n \tunsigned dirty_submodule = 0;\n \n-\tif (get_stat_data(new, &oid, &mode, cached, match_missing,\n+\tif (get_stat_data(new_entry, &oid, &mode, cached, match_missing,\n \t\t\t  &dirty_submodule, &revs->diffopt) < 0) {\n \t\tif (report_missing)\n \t\t\tdiff_index_show_file(revs, \"-\", old,\n@@ -340,21 +340,21 @@ static int show_modified(struct rev_info *revs,\n \t}\n \n \tif (revs->combine_merges && !cached &&\n-\t    (oidcmp(oid, &old->oid) || oidcmp(&old->oid, &new->oid))) {\n+\t    (oidcmp(oid, &old->oid) || oidcmp(&old->oid, &new_entry->oid))) {\n \t\tstruct combine_diff_path *p;\n-\t\tint pathlen = ce_namelen(new);\n+\t\tint pathlen = ce_namelen(new_entry);\n \n \t\tp = xmalloc(combine_diff_path_size(2, pathlen));\n \t\tp->path = (char *) &p->parent[2];\n \t\tp->next = NULL;\n-\t\tmemcpy(p->path, new->name, pathlen);\n+\t\tmemcpy(p->path, new_entry->name, pathlen);\n \t\tp->path[pathlen] = 0;\n \t\tp->mode = mode;\n \t\toidclr(&p->oid);\n \t\tmemset(p->parent, 0, 2 * sizeof(struct combine_diff_parent));\n \t\tp->parent[0].status = DIFF_STATUS_MODIFIED;\n-\t\tp->parent[0].mode = new->ce_mode;\n-\t\toidcpy(&p->parent[0].oid, &new->oid);\n+\t\tp->parent[0].mode = new_entry->ce_mode;\n+\t\toidcpy(&p->parent[0].oid, &new_entry->oid);\n \t\tp->parent[1].status = DIFF_STATUS_MODIFIED;\n \t\tp->parent[1].mode = old->ce_mode;\n \t\toidcpy(&p->parent[1].oid, &old->oid);\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337745","messageId":"20180129223728.30569-11-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 10/37] help: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:01Z","receivedAt":"2018-01-29T22:40:16Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/help.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex d3c8fc408..598867cfe 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -194,11 +194,11 @@ static void do_add_man_viewer_info(const char *name,\n \t\t\t\t   size_t len,\n \t\t\t\t   const char *value)\n {\n-\tstruct man_viewer_info_list *new;\n-\tFLEX_ALLOC_MEM(new, name, name, len);\n-\tnew->info = xstrdup(value);\n-\tnew->next = man_viewer_info_list;\n-\tman_viewer_info_list = new;\n+\tstruct man_viewer_info_list *new_man_viewer;\n+\tFLEX_ALLOC_MEM(new_man_viewer, name, name, len);\n+\tnew_man_viewer->info = xstrdup(value);\n+\tnew_man_viewer->next = man_viewer_info_list;\n+\tman_viewer_info_list = new_man_viewer;\n }\n \n static int add_man_viewer_path(const char *name,\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337746","messageId":"20180129223728.30569-14-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 13/37] remote: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:04Z","receivedAt":"2018-01-29T22:40:22Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/remote.c | 44 ++++++++++++++++++++++----------------------\n 1 file changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex d95bf904c..4f4783e70 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -322,7 +322,7 @@ static void read_branches(void)\n \n struct ref_states {\n \tstruct remote *remote;\n-\tstruct string_list new, stale, tracked, heads, push;\n+\tstruct string_list new_refs, stale, tracked, heads, push;\n \tint queried;\n };\n \n@@ -337,12 +337,12 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat\n \t\t\tdie(_(\"Could not get fetch map for refspec %s\"),\n \t\t\t\tstates->remote->fetch_refspec[i]);\n \n-\tstates->new.strdup_strings = 1;\n+\tstates->new_refs.strdup_strings = 1;\n \tstates->tracked.strdup_strings = 1;\n \tstates->stale.strdup_strings = 1;\n \tfor (ref = fetch_map; ref; ref = ref->next) {\n \t\tif (!ref->peer_ref || !ref_exists(ref->peer_ref->name))\n-\t\t\tstring_list_append(&states->new, abbrev_branch(ref->name));\n+\t\t\tstring_list_append(&states->new_refs, abbrev_branch(ref->name));\n \t\telse\n \t\t\tstring_list_append(&states->tracked, abbrev_branch(ref->name));\n \t}\n@@ -356,7 +356,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat\n \tfree_refs(stale_refs);\n \tfree_refs(fetch_map);\n \n-\tstring_list_sort(&states->new);\n+\tstring_list_sort(&states->new_refs);\n \tstring_list_sort(&states->tracked);\n \tstring_list_sort(&states->stale);\n \n@@ -547,7 +547,7 @@ static int add_branch_for_removal(const char *refname,\n \n struct rename_info {\n \tconst char *old;\n-\tconst char *new;\n+\tconst char *new_name;\n \tstruct string_list *remote_branches;\n };\n \n@@ -616,33 +616,33 @@ static int mv(int argc, const char **argv)\n \t\tusage_with_options(builtin_remote_rename_usage, options);\n \n \trename.old = argv[1];\n-\trename.new = argv[2];\n+\trename.new_name = argv[2];\n \trename.remote_branches = &remote_branches;\n \n \toldremote = remote_get(rename.old);\n \tif (!remote_is_configured(oldremote, 1))\n \t\tdie(_(\"No such remote: %s\"), rename.old);\n \n-\tif (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)\n+\tif (!strcmp(rename.old, rename.new_name) && oldremote->origin != REMOTE_CONFIG)\n \t\treturn migrate_file(oldremote);\n \n-\tnewremote = remote_get(rename.new);\n+\tnewremote = remote_get(rename.new_name);\n \tif (remote_is_configured(newremote, 1))\n-\t\tdie(_(\"remote %s already exists.\"), rename.new);\n+\t\tdie(_(\"remote %s already exists.\"), rename.new_name);\n \n-\tstrbuf_addf(&buf, \"refs/heads/test:refs/remotes/%s/test\", rename.new);\n+\tstrbuf_addf(&buf, \"refs/heads/test:refs/remotes/%s/test\", rename.new_name);\n \tif (!valid_fetch_refspec(buf.buf))\n-\t\tdie(_(\"'%s' is not a valid remote name\"), rename.new);\n+\t\tdie(_(\"'%s' is not a valid remote name\"), rename.new_name);\n \n \tstrbuf_reset(&buf);\n \tstrbuf_addf(&buf, \"remote.%s\", rename.old);\n-\tstrbuf_addf(&buf2, \"remote.%s\", rename.new);\n+\tstrbuf_addf(&buf2, \"remote.%s\", rename.new_name);\n \tif (git_config_rename_section(buf.buf, buf2.buf) < 1)\n \t\treturn error(_(\"Could not rename config section '%s' to '%s'\"),\n \t\t\t\tbuf.buf, buf2.buf);\n \n \tstrbuf_reset(&buf);\n-\tstrbuf_addf(&buf, \"remote.%s.fetch\", rename.new);\n+\tstrbuf_addf(&buf, \"remote.%s.fetch\", rename.new_name);\n \tgit_config_set_multivar(buf.buf, NULL, NULL, 1);\n \tstrbuf_addf(&old_remote_context, \":refs/remotes/%s/\", rename.old);\n \tfor (i = 0; i < oldremote->fetch_refspec_nr; i++) {\n@@ -655,8 +655,8 @@ static int mv(int argc, const char **argv)\n \t\t\trefspec_updated = 1;\n \t\t\tstrbuf_splice(&buf2,\n \t\t\t\t      ptr-buf2.buf + strlen(\":refs/remotes/\"),\n-\t\t\t\t      strlen(rename.old), rename.new,\n-\t\t\t\t      strlen(rename.new));\n+\t\t\t\t      strlen(rename.old), rename.new_name,\n+\t\t\t\t      strlen(rename.new_name));\n \t\t} else\n \t\t\twarning(_(\"Not updating non-default fetch refspec\\n\"\n \t\t\t\t  \"\\t%s\\n\"\n@@ -673,7 +673,7 @@ static int mv(int argc, const char **argv)\n \t\tif (info->remote_name && !strcmp(info->remote_name, rename.old)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.remote\", item->string);\n-\t\t\tgit_config_set(buf.buf, rename.new);\n+\t\t\tgit_config_set(buf.buf, rename.new_name);\n \t\t}\n \t}\n \n@@ -704,7 +704,7 @@ static int mv(int argc, const char **argv)\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addstr(&buf, item->string);\n \t\tstrbuf_splice(&buf, strlen(\"refs/remotes/\"), strlen(rename.old),\n-\t\t\t\trename.new, strlen(rename.new));\n+\t\t\t\trename.new_name, strlen(rename.new_name));\n \t\tstrbuf_reset(&buf2);\n \t\tstrbuf_addf(&buf2, \"remote: renamed %s to %s\",\n \t\t\t\titem->string, buf.buf);\n@@ -719,11 +719,11 @@ static int mv(int argc, const char **argv)\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addstr(&buf, item->string);\n \t\tstrbuf_splice(&buf, strlen(\"refs/remotes/\"), strlen(rename.old),\n-\t\t\t\trename.new, strlen(rename.new));\n+\t\t\t\trename.new_name, strlen(rename.new_name));\n \t\tstrbuf_reset(&buf2);\n \t\tstrbuf_addstr(&buf2, item->util);\n \t\tstrbuf_splice(&buf2, strlen(\"refs/remotes/\"), strlen(rename.old),\n-\t\t\t\trename.new, strlen(rename.new));\n+\t\t\t\trename.new_name, strlen(rename.new_name));\n \t\tstrbuf_reset(&buf3);\n \t\tstrbuf_addf(&buf3, \"remote: renamed %s to %s\",\n \t\t\t\titem->string, buf.buf);\n@@ -822,7 +822,7 @@ static void clear_push_info(void *util, const char *string)\n \n static void free_remote_ref_states(struct ref_states *states)\n {\n-\tstring_list_clear(&states->new, 0);\n+\tstring_list_clear(&states->new_refs, 0);\n \tstring_list_clear(&states->stale, 1);\n \tstring_list_clear(&states->tracked, 0);\n \tstring_list_clear(&states->heads, 0);\n@@ -907,7 +907,7 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)\n \tif (states->queried) {\n \t\tconst char *fmt = \"%s\";\n \t\tconst char *arg = \"\";\n-\t\tif (string_list_has_string(&states->new, name)) {\n+\t\tif (string_list_has_string(&states->new_refs, name)) {\n \t\t\tfmt = _(\" new (next fetch will store in remotes/%s)\");\n \t\t\targ = states->remote->name;\n \t\t} else if (string_list_has_string(&states->tracked, name))\n@@ -1176,7 +1176,7 @@ static int show(int argc, const char **argv)\n \n \t\t/* remote branch info */\n \t\tinfo.width = 0;\n-\t\tfor_each_string_list(&states.new, add_remote_to_show_info, &info);\n+\t\tfor_each_string_list(&states.new_refs, add_remote_to_show_info, &info);\n \t\tfor_each_string_list(&states.tracked, add_remote_to_show_info, &info);\n \t\tfor_each_string_list(&states.stale, add_remote_to_show_info, &info);\n \t\tif (info.list->nr)\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337747","messageId":"20180129223728.30569-12-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 11/37] pack-redundant: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:02Z","receivedAt":"2018-01-29T22:40:28Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/pack-redundant.c | 48 ++++++++++++++++++++++++------------------------\n 1 file changed, 24 insertions(+), 24 deletions(-)\n\ndiff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c\nindex aaa813632..e18b53df8 100644\n--- a/builtin/pack-redundant.c\n+++ b/builtin/pack-redundant.c\n@@ -48,17 +48,17 @@ static inline void llist_item_put(struct llist_item *item)\n \n static inline struct llist_item *llist_item_get(void)\n {\n-\tstruct llist_item *new;\n+\tstruct llist_item *new_item;\n \tif ( free_nodes ) {\n-\t\tnew = free_nodes;\n+\t\tnew_item = free_nodes;\n \t\tfree_nodes = free_nodes->next;\n \t} else {\n \t\tint i = 1;\n-\t\tALLOC_ARRAY(new, BLKSIZE);\n+\t\tALLOC_ARRAY(new_item, BLKSIZE);\n \t\tfor (; i < BLKSIZE; i++)\n-\t\t\tllist_item_put(&new[i]);\n+\t\t\tllist_item_put(&new_item[i]);\n \t}\n-\treturn new;\n+\treturn new_item;\n }\n \n static void llist_free(struct llist *list)\n@@ -80,26 +80,26 @@ static inline void llist_init(struct llist **list)\n static struct llist * llist_copy(struct llist *list)\n {\n \tstruct llist *ret;\n-\tstruct llist_item *new, *old, *prev;\n+\tstruct llist_item *new_item, *old, *prev;\n \n \tllist_init(&ret);\n \n \tif ((ret->size = list->size) == 0)\n \t\treturn ret;\n \n-\tnew = ret->front = llist_item_get();\n-\tnew->sha1 = list->front->sha1;\n+\tnew_item = ret->front = llist_item_get();\n+\tnew_item->sha1 = list->front->sha1;\n \n \told = list->front->next;\n \twhile (old) {\n-\t\tprev = new;\n-\t\tnew = llist_item_get();\n-\t\tprev->next = new;\n-\t\tnew->sha1 = old->sha1;\n+\t\tprev = new_item;\n+\t\tnew_item = llist_item_get();\n+\t\tprev->next = new_item;\n+\t\tnew_item->sha1 = old->sha1;\n \t\told = old->next;\n \t}\n-\tnew->next = NULL;\n-\tret->back = new;\n+\tnew_item->next = NULL;\n+\tret->back = new_item;\n \n \treturn ret;\n }\n@@ -108,24 +108,24 @@ static inline struct llist_item *llist_insert(struct llist *list,\n \t\t\t\t\t      struct llist_item *after,\n \t\t\t\t\t       const unsigned char *sha1)\n {\n-\tstruct llist_item *new = llist_item_get();\n-\tnew->sha1 = sha1;\n-\tnew->next = NULL;\n+\tstruct llist_item *new_item = llist_item_get();\n+\tnew_item->sha1 = sha1;\n+\tnew_item->next = NULL;\n \n \tif (after != NULL) {\n-\t\tnew->next = after->next;\n-\t\tafter->next = new;\n+\t\tnew_item->next = after->next;\n+\t\tafter->next = new_item;\n \t\tif (after == list->back)\n-\t\t\tlist->back = new;\n+\t\t\tlist->back = new_item;\n \t} else {/* insert in front */\n \t\tif (list->size == 0)\n-\t\t\tlist->back = new;\n+\t\t\tlist->back = new_item;\n \t\telse\n-\t\t\tnew->next = list->front;\n-\t\tlist->front = new;\n+\t\t\tnew_item->next = list->front;\n+\t\tlist->front = new_item;\n \t}\n \tlist->size++;\n-\treturn new;\n+\treturn new_item;\n }\n \n static inline struct llist_item *llist_insert_back(struct llist *list,\n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337749","messageId":"20180129223728.30569-13-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH 12/37] reflog: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-01-29T22:37:03Z","receivedAt":"2018-01-29T22:40:34Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/reflog.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 223372531..c1bcab5c5 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -289,20 +289,20 @@ static int should_expire_reflog_ent(struct object_id *ooid, struct object_id *no\n \t\t\t\t    const char *message, void *cb_data)\n {\n \tstruct expire_reflog_policy_cb *cb = cb_data;\n-\tstruct commit *old, *new;\n+\tstruct commit *old, *new_commit;\n \n \tif (timestamp < cb->cmd.expire_total)\n \t\treturn 1;\n \n-\told = new = NULL;\n+\told = new_commit = NULL;\n \tif (cb->cmd.stalefix &&\n-\t    (!keep_entry(&old, ooid) || !keep_entry(&new, noid)))\n+\t    (!keep_entry(&old, ooid) || !keep_entry(&new_commit, noid)))\n \t\treturn 1;\n \n \tif (timestamp < cb->cmd.expire_unreachable) {\n \t\tif (cb->unreachable_expire_kind == UE_ALWAYS)\n \t\t\treturn 1;\n-\t\tif (unreachable(cb, old, ooid) || unreachable(cb, new, noid))\n+\t\tif (unreachable(cb, old, ooid) || unreachable(cb, new_commit, noid))\n \t\t\treturn 1;\n \t}\n \n-- \n2.16.0.rc1.238.g530d649a79-goog\n\n"},{"id":"337768","messageId":"CACsJy8Cm8HsopKisiJkwtPyfv-O6Ei3waew6CsKLXzKv7=TriQ@mail.gmail.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"Re: [PATCH 00/37] removal of some c++ keywords","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-01-30T00:13:16Z","receivedAt":"2018-01-30T00:13:52Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Jan 30, 2018 at 5:36 AM, Brandon Williams <bmwill@google.com> wrote:\n> A while back there was some discussion of getting our codebase into a state\n> where we could use a c++ compiler if we wanted to (for various reason like\n> leveraging c++ only analysis tools, etc.).  Johannes Sixt had a very large\n\nI would be more convinced if I knew exactly what leverage we could\nhave here (e.g. what tool, how many problems it caught...).\n\n> patch that achieved this but it wasn't in a state where it could be upstreamed.\n> I took that idea and did some removals of c++ keywords (new, template, try,\n> this, etc) but broke it up into several (well maybe more than several) patches.\n> I don't believe I've captured all of them in this series but this is at least\n> moving a step closer to being able to compile using a c++ compiler.\n\nIs it simpler (though hacky) to just  do\n\n#ifdef __cplusplus\n#define new not_new\n#define try really_try\n...\n\nsomewhere in git-compat-util.h?\n\nDo we use any C features that are incompatible with C++? (or do we not\nneed to care?)\n\n> I don't know if this is something the community still wants to move towards,\n> but if this is something people are still interested in, and this series is\n> wanted, then we can keep doing these sort of conversions in chunks slowly.\n\nYou're going to need to setup C++ build job on Travis or something to\ncatch new C++ keywords from entering the code base as well if you move\nthis to the end.\n-- \nDuy\n"},{"id":"337811","messageId":"cd708bfc-6f92-18d8-9121-ed413748f14a@kdbg.org","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"Re: [PATCH 00/37] removal of some c++ keywords","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2018-01-30T20:54:32Z","receivedAt":"2018-01-30T20:54:43Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 29.01.2018 um 23:36 schrieb Brandon Williams:\n> A while back there was some discussion of getting our codebase into a state\n> where we could use a c++ compiler if we wanted to (for various reason like\n> leveraging c++ only analysis tools, etc.).  Johannes Sixt had a very large\n> patch that achieved this but it wasn't in a state where it could be upstreamed.\n> I took that idea and did some removals of c++ keywords (new, template, try,\n> this, etc) but broke it up into several (well maybe more than several) patches.\n> I don't believe I've captured all of them in this series but this is at least\n> moving a step closer to being able to compile using a c++ compiler.\n\nCool! The patches all look reasonable. Some keywords remain: 'delete', \n'private', 'thread_local', 'not', 'xor', 'explicit', 'export'.\n\n> I don't know if this is something the community still wants to move towards,\n> but if this is something people are still interested in, and this series is\n> wanted, then we can keep doing these sort of conversions in chunks slowly.\n\nI've rebased my patches on top of this series. They are available from\n\n   https://github.com/j6t/git.git c-plus-plus\n\n-- Hannes\n"},{"id":"337849","messageId":"xmqq7erzrn3f.fsf@gitster-ct.c.googlers.com","threadId":"47717","inReplyTo":"CACsJy8Cm8HsopKisiJkwtPyfv-O6Ei3waew6CsKLXzKv7=TriQ@mail.gmail.com","subject":"Re: [PATCH 00/37] removal of some c++ keywords","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-30T22:36:04Z","receivedAt":"2018-01-30T22:36:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> Is it simpler (though hacky) to just  do\n>\n> #ifdef __cplusplus\n> #define new not_new\n> #define try really_try\n> ...\n>\n> somewhere in git-compat-util.h?\n\nVery tempting, especially given that your approach automatically\nwould cover topics in flight without any merge conflict ;-)\n\nI agree that it is hacky and somewhat ugly, but the hackiness\nsomehow does not bother me too much in this case; perhaps because\nattempting to use a C++ compiler may already be hacky in the first\nplace?\n\nIt probably depends on the reason why we are doing this topic.  If a\nreport about our source code coming from the C++ oriented tool cite\nthe symbol names seen by machines, then the \"hacky\" approach will\ngive us \"not_new\" where Brandon's patch may give us \"new_oid\", or\nwhatever symbol that is more appropriate for the context it appears\nthan such an automated cute name.\n\n> Do we use any C features that are incompatible with C++? (or do we not\n> need to care?)\n\nGood question.\n"},{"id":"337852","messageId":"CAGZ79kYwOc3vMsj8DWyNtudM-OBzyw8iTEfKK3nnOJM23GF78A@mail.gmail.com","threadId":"47717","inReplyTo":"20180129223728.30569-38-bmwill@google.com","subject":"Re: [PATCH 37/37] replace: rename 'new' variables","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-01-30T22:58:46Z","receivedAt":"2018-01-30T22:58:51Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Jan 29, 2018 at 2:37 PM, Brandon Williams <bmwill@google.com> wrote:\n> Rename C++ keyword in order to bring the codebase closer to being able\n> to be compiled with a C++ compiler.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n>  builtin/replace.c | 16 ++++++++--------\n>  1 file changed, 8 insertions(+), 8 deletions(-)\n>\n> diff --git a/builtin/replace.c b/builtin/replace.c\n> index 42cf4f62a..e48835b54 100644\n> --- a/builtin/replace.c\n> +++ b/builtin/replace.c\n> @@ -284,7 +284,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)\n>  {\n>         char *tmpfile = git_pathdup(\"REPLACE_EDITOBJ\");\n>         enum object_type type;\n> -       struct object_id old, new, prev;\n> +       struct object_id old, new_oid, prev;\n\nnew is a keyword that often comes with a counterpart, here `old`.\nSo while at it, also rename old to old_oid ?\nDo we care about the symmetry enough to warrant additional churn for this?\n\nStefan\n"},{"id":"337853","messageId":"CAGZ79kZ-hZzKtv05d5_7O2ndNZvGkU7qYnrn52zwpqSTqCiygQ@mail.gmail.com","threadId":"47717","inReplyTo":"xmqq7erzrn3f.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/37] removal of some c++ keywords","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-01-30T23:01:46Z","receivedAt":"2018-01-30T23:01:58Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Duy Nguyen <pclouds@gmail.com> writes:\n>\n>> Is it simpler (though hacky) to just  do\n>>\n>> #ifdef __cplusplus\n>> #define new not_new\n>> #define try really_try\n>> ...\n>>\n>> somewhere in git-compat-util.h?\n>\n> Very tempting, especially given that your approach automatically\n> would cover topics in flight without any merge conflict ;-)\n>\n> I agree that it is hacky and somewhat ugly, but the hackiness\n> somehow does not bother me too much in this case; perhaps because\n> attempting to use a C++ compiler may already be hacky in the first\n> place?\n>\n> It probably depends on the reason why we are doing this topic.  If a\n> report about our source code coming from the C++ oriented tool cite\n> the symbol names seen by machines, then the \"hacky\" approach will\n> give us \"not_new\" where Brandon's patch may give us \"new_oid\", or\n> whatever symbol that is more appropriate for the context it appears\n> than such an automated cute name.\n>\n>> Do we use any C features that are incompatible with C++? (or do we not\n>> need to care?)\n>\n> Good question.\n\nimplicit casts from void?\ne.g. xmalloc returns a void pointer, not the type requested.\nhttps://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc\n"},{"id":"337856","messageId":"xmqq372nrl0f.fsf@gitster-ct.c.googlers.com","threadId":"47717","inReplyTo":"CAGZ79kYwOc3vMsj8DWyNtudM-OBzyw8iTEfKK3nnOJM23GF78A@mail.gmail.com","subject":"Re: [PATCH 37/37] replace: rename 'new' variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-30T23:21:04Z","receivedAt":"2018-01-30T23:21:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> On Mon, Jan 29, 2018 at 2:37 PM, Brandon Williams <bmwill@google.com> wrote:\n>> Rename C++ keyword in order to bring the codebase closer to being able\n>> to be compiled with a C++ compiler.\n>>\n>> Signed-off-by: Brandon Williams <bmwill@google.com>\n>> ---\n>>  builtin/replace.c | 16 ++++++++--------\n>>  1 file changed, 8 insertions(+), 8 deletions(-)\n>>\n>> diff --git a/builtin/replace.c b/builtin/replace.c\n>> index 42cf4f62a..e48835b54 100644\n>> --- a/builtin/replace.c\n>> +++ b/builtin/replace.c\n>> @@ -284,7 +284,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)\n>>  {\n>>         char *tmpfile = git_pathdup(\"REPLACE_EDITOBJ\");\n>>         enum object_type type;\n>> -       struct object_id old, new, prev;\n>> +       struct object_id old, new_oid, prev;\n>\n> new is a keyword that often comes with a counterpart, here `old`.\n> So while at it, also rename old to old_oid ?\n> Do we care about the symmetry enough to warrant additional churn for this?\n\nAbsolutely.  That is one of the reasons why the \"hacky\" approach is\nso attractive---it does not force those who are doing conversion to\nthink.  With this approach, \"new\" in this context gets replaced with\nnew_oid (because this is about oid; in another codepath, \"new\" and\n\"old\" might have been referring to a file and the new names for them\nwould have been \"new_file\" vs \"old_file\") after some thought, and\nthe same thought process should realize \"old\" must become \"old_oid\".\n\nVery good point.\n"},{"id":"337893","messageId":"CACsJy8C98HD59DGgqyWtZzj2RVqFe9GN=810A6fs2mMYBh_53Q@mail.gmail.com","threadId":"47717","inReplyTo":"CAGZ79kZ-hZzKtv05d5_7O2ndNZvGkU7qYnrn52zwpqSTqCiygQ@mail.gmail.com","subject":"Re: [PATCH 00/37] removal of some c++ keywords","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-01-31T00:48:57Z","receivedAt":"2018-01-31T00:49:36Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Jan 31, 2018 at 6:01 AM, Stefan Beller <sbeller@google.com> wrote:\n> On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Duy Nguyen <pclouds@gmail.com> writes:\n>>\n>>> Is it simpler (though hacky) to just  do\n>>>\n>>> #ifdef __cplusplus\n>>> #define new not_new\n>>> #define try really_try\n>>> ...\n>>>\n>>> somewhere in git-compat-util.h?\n>>\n>> Very tempting, especially given that your approach automatically\n>> would cover topics in flight without any merge conflict ;-)\n>>\n>> I agree that it is hacky and somewhat ugly, but the hackiness\n>> somehow does not bother me too much in this case; perhaps because\n>> attempting to use a C++ compiler may already be hacky in the first\n>> place?\n>>\n>> It probably depends on the reason why we are doing this topic.  If a\n>> report about our source code coming from the C++ oriented tool cite\n>> the symbol names seen by machines, then the \"hacky\" approach will\n>> give us \"not_new\" where Brandon's patch may give us \"new_oid\", or\n>> whatever symbol that is more appropriate for the context it appears\n>> than such an automated cute name.\n\nWell. the world after post processing is always ugly. But we could try\n\"#define new new__\" to get the not so ugly names. new_oid is\ndefinitely better regardless of c/c++ though so I could see that as a\ngood cleanup.\n\n>>> Do we use any C features that are incompatible with C++? (or do we not\n>>> need to care?)\n>>\n>> Good question.\n>\n> implicit casts from void?\n> e.g. xmalloc returns a void pointer, not the type requested.\n> https://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc\n\nThat causes lots of warnings but not errors (I bit the bullet and\ntried to compile git with g++). The next set of changes would be to\nreorganize nested enum/struct declarations. Even if nested, C\nconsiders these flat while C++ sees them in namespaces. There's some\nwarnings about confusion with the new cool feature string literals,\nbut that's easy to fix.\n\nThere's also C99 designator in builtin/clean.c (I thought we avoided\nC99, I can start using this specific feature more now :D)\n\nI was stuck at the thread_local thing in index-pack.c and gave up. So\nI don't know what else we would need to change.\n-- \nDuy\n"},{"id":"337894","messageId":"CAGZ79kZNB=3fXOeJwhXGqyBi3mKmE-9nmM-ooXJOzy5OcYaoqQ@mail.gmail.com","threadId":"47717","inReplyTo":"CACsJy8C98HD59DGgqyWtZzj2RVqFe9GN=810A6fs2mMYBh_53Q@mail.gmail.com","subject":"Re: [PATCH 00/37] removal of some c++ keywords","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-01-31T00:57:58Z","receivedAt":"2018-01-31T00:58:08Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Jan 30, 2018 at 4:48 PM, Duy Nguyen <pclouds@gmail.com> wrote:\n> On Wed, Jan 31, 2018 at 6:01 AM, Stefan Beller <sbeller@google.com> wrote:\n>> On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Duy Nguyen <pclouds@gmail.com> writes:\n>>>\n>>>> Is it simpler (though hacky) to just  do\n>>>>\n>>>> #ifdef __cplusplus\n>>>> #define new not_new\n>>>> #define try really_try\n>>>> ...\n>>>>\n>>>> somewhere in git-compat-util.h?\n>>>\n>>> Very tempting, especially given that your approach automatically\n>>> would cover topics in flight without any merge conflict ;-)\n>>>\n>>> I agree that it is hacky and somewhat ugly, but the hackiness\n>>> somehow does not bother me too much in this case; perhaps because\n>>> attempting to use a C++ compiler may already be hacky in the first\n>>> place?\n>>>\n>>> It probably depends on the reason why we are doing this topic.  If a\n>>> report about our source code coming from the C++ oriented tool cite\n>>> the symbol names seen by machines, then the \"hacky\" approach will\n>>> give us \"not_new\" where Brandon's patch may give us \"new_oid\", or\n>>> whatever symbol that is more appropriate for the context it appears\n>>> than such an automated cute name.\n>\n> Well. the world after post processing is always ugly. But we could try\n> \"#define new new__\" to get the not so ugly names. new_oid is\n> definitely better regardless of c/c++ though so I could see that as a\n> good cleanup.\n>\n>>>> Do we use any C features that are incompatible with C++? (or do we not\n>>>> need to care?)\n>>>\n>>> Good question.\n>>\n>> implicit casts from void?\n>> e.g. xmalloc returns a void pointer, not the type requested.\n>> https://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc\n>\n> That causes lots of warnings but not errors (I bit the bullet and\n> tried to compile git with g++).\n\nAnd for g++ there is a flag to disable this specific set of warnings.\nI think the value of using C++ analysis tools is in the LLVM/clang\nworld, not GNU.\n\n> The next set of changes would be to\n> reorganize nested enum/struct declarations. Even if nested, C\n> considers these flat while C++ sees them in namespaces. There's some\n> warnings about confusion with the new cool feature string literals,\n> but that's easy to fix.\n>\n> There's also C99 designator in builtin/clean.c (I thought we avoided\n> C99, I can start using this specific feature more now :D)\n\nThat was a test balloon? See 512f41cfac\n(clean.c: use designated initializer, 2017-07-14)\n\nOne of the big advantages would be stricter type checking, such as\nsigned/unsigned confusion, that we occasionally have.\ne.g. 61d36330b4 (prefer \"!=\" when checking read_in_full()\nresult, 2017-09-27) or what is referenced from there 561598cfcf\n(read_pack_header: handle signed/unsigned comparison in read result,\n2017-09-13).\n\nThe bugs resulting in these patches could have been caught more easily\nwith C++ checking IMHO.\n\n> I was stuck at the thread_local thing in index-pack.c and gave up. So\n> I don't know what else we would need to change.\n\nThanks for experimenting!\nStefan\n\n> --\n> Duy\n"},{"id":"337896","messageId":"CACsJy8A=wLAY_Jmw-DRd_R0i-SW0qB-d9m13GohfTk16DY2ejg@mail.gmail.com","threadId":"47717","inReplyTo":"CAGZ79kZNB=3fXOeJwhXGqyBi3mKmE-9nmM-ooXJOzy5OcYaoqQ@mail.gmail.com","subject":"Re: [PATCH 00/37] removal of some c++ keywords","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-01-31T01:05:56Z","receivedAt":"2018-01-31T01:06:32Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Jan 31, 2018 at 7:57 AM, Stefan Beller <sbeller@google.com> wrote:\n>> There's also C99 designator in builtin/clean.c (I thought we avoided\n>> C99, I can start using this specific feature more now :D)\n>\n> That was a test balloon? See 512f41cfac\n> (clean.c: use designated initializer, 2017-07-14)\n\nAww.. I thought it was in there since forever and it should be safe to\nuse now...\n\n> One of the big advantages would be stricter type checking, such as\n> signed/unsigned confusion, that we occasionally have.\n> e.g. 61d36330b4 (prefer \"!=\" when checking read_in_full()\n> result, 2017-09-27) or what is referenced from there 561598cfcf\n> (read_pack_header: handle signed/unsigned comparison in read result,\n> 2017-09-13).\n\nWe can do that even with C (at least with gcc and I guess clang as\nwell). The problem is it looks so bad right now that I have to turn it\noff with -Wno-sign-compare\n\n> The bugs resulting in these patches could have been caught more easily\n> with C++ checking IMHO.\n-- \nDuy\n"},{"id":"339345","messageId":"20180214185959.221906-1-bmwill@google.com","threadId":"47717","inReplyTo":"20180129223728.30569-1-bmwill@google.com","subject":"[PATCH v2 00/37] removal of some c++ keywords","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:22Z","receivedAt":"2018-02-14T19:00:48Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"One person was interested enough for me to go back through and also\nrename all the paired 'old' variables to match the new names for the\nvariables which were named 'new'.\n\nBrandon Williams (37):\n  object_info: change member name from 'typename' to 'type_name'\n  object: rename function 'typename' to 'type_name'\n  blame: rename 'this' variables\n  pack-objects: rename 'this' variables\n  rev-parse: rename 'this' variable\n  diff: rename 'this' variables\n  apply: rename 'try' variables\n  apply: rename 'new' variables\n  checkout: rename 'new' variables\n  help: rename 'new' variables\n  pack-redundant: rename 'new' variables\n  reflog: rename 'new' variables\n  remote: rename 'new' variables\n  combine-diff: rename 'new' variables\n  commit: rename 'new' variables\n  diff-lib: rename 'new' variable\n  diff: rename 'new' variables\n  diffcore-delta: rename 'new' variables\n  entry: rename 'new' variables\n  http: rename 'new' variables\n  imap-send: rename 'new' variables\n  line-log: rename 'new' variables\n  read-cache: rename 'new' variables\n  ref-filter: rename 'new' variables\n  remote: rename 'new' variables\n  split-index: rename 'new' variables\n  submodule: rename 'new' variables\n  trailer: rename 'new' variables\n  unpack-trees: rename 'new' variables\n  init-db: rename 'template' variables\n  environment: rename 'template' variables\n  diff: rename 'template' variables\n  environment: rename 'namespace' variables\n  wrapper: rename 'template' variables\n  tempfile: rename 'template' variables\n  trailer: rename 'template' variables\n  replace: rename 'new' variables\n\n apply.c                                | 122 +++++++--------\n blame.c                                |  33 +++--\n builtin/cat-file.c                     |   4 +-\n builtin/checkout.c                     | 196 ++++++++++++-------------\n builtin/diff-tree.c                    |   2 +-\n builtin/fast-export.c                  |   8 +-\n builtin/fsck.c                         |   4 +-\n builtin/grep.c                         |   2 +-\n builtin/help.c                         |  10 +-\n builtin/index-pack.c                   |  12 +-\n builtin/init-db.c                      |  30 ++--\n builtin/merge.c                        |   2 +-\n builtin/mktree.c                       |   4 +-\n builtin/pack-objects.c                 |   8 +-\n builtin/pack-redundant.c               |  54 +++----\n builtin/prune.c                        |   2 +-\n builtin/reflog.c                       |   8 +-\n builtin/remote.c                       |  66 ++++-----\n builtin/replace.c                      |  46 +++---\n builtin/rev-parse.c                    |  34 ++---\n builtin/tag.c                          |   2 +-\n builtin/unpack-objects.c               |  10 +-\n builtin/verify-commit.c                |   2 +-\n bulk-checkin.c                         |   2 +-\n cache.h                                |   4 +-\n combine-diff.c                         |  12 +-\n commit.c                               |  20 +--\n contrib/examples/builtin-fetch--tool.c |   2 +-\n diff-lib.c                             |  38 ++---\n diff.c                                 |  62 ++++----\n diffcore-delta.c                       |  16 +-\n entry.c                                |  40 ++---\n environment.c                          |  24 +--\n fast-import.c                          |  16 +-\n fsck.c                                 |   2 +-\n git-compat-util.h                      |   4 +-\n http-push.c                            |   2 +-\n http.c                                 |  10 +-\n imap-send.c                            |  14 +-\n line-log.c                             |  56 +++----\n log-tree.c                             |   2 +-\n object.c                               |   6 +-\n object.h                               |   2 +-\n pack-check.c                           |   2 +-\n packfile.c                             |   8 +-\n reachable.c                            |   2 +-\n read-cache.c                           |  40 ++---\n ref-filter.c                           |  20 +--\n remote.c                               |  20 +--\n sequencer.c                            |   2 +-\n sha1_file.c                            |  28 ++--\n sha1_name.c                            |   6 +-\n split-index.c                          |  16 +-\n split-index.h                          |   2 +-\n submodule.c                            |  32 ++--\n submodule.h                            |   2 +-\n tag.c                                  |   2 +-\n tempfile.c                             |  12 +-\n tempfile.h                             |  34 ++---\n trailer.c                              |  44 +++---\n unpack-trees.c                         |   6 +-\n walker.c                               |   4 +-\n wrapper.c                              |  40 ++---\n 63 files changed, 659 insertions(+), 658 deletions(-)\n\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339346","messageId":"20180214185959.221906-2-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 01/37] object_info: change member name from 'typename' to 'type_name'","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:23Z","receivedAt":"2018-02-14T19:00:51Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/cat-file.c |  2 +-\n cache.h            |  2 +-\n packfile.c         |  6 +++---\n sha1_file.c        | 10 +++++-----\n 4 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex f5fa4fd75..d06c66c77 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -76,7 +76,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \tbuf = NULL;\n \tswitch (opt) {\n \tcase 't':\n-\t\toi.typename = &sb;\n+\t\toi.type_name = &sb;\n \t\tif (sha1_object_info_extended(oid.hash, &oi, flags) < 0)\n \t\t\tdie(\"git cat-file: could not get object info\");\n \t\tif (sb.len) {\ndiff --git a/cache.h b/cache.h\nindex d8b975a57..69b5a3bf8 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1744,7 +1744,7 @@ struct object_info {\n \tunsigned long *sizep;\n \toff_t *disk_sizep;\n \tunsigned char *delta_base_sha1;\n-\tstruct strbuf *typename;\n+\tstruct strbuf *type_name;\n \tvoid **contentp;\n \n \t/* Response */\ndiff --git a/packfile.c b/packfile.c\nindex 4a5fe7ab1..6657a0a49 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1350,16 +1350,16 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,\n \t\t*oi->disk_sizep = revidx[1].offset - obj_offset;\n \t}\n \n-\tif (oi->typep || oi->typename) {\n+\tif (oi->typep || oi->type_name) {\n \t\tenum object_type ptot;\n \t\tptot = packed_to_object_type(p, obj_offset, type, &w_curs,\n \t\t\t\t\t     curpos);\n \t\tif (oi->typep)\n \t\t\t*oi->typep = ptot;\n-\t\tif (oi->typename) {\n+\t\tif (oi->type_name) {\n \t\t\tconst char *tn = typename(ptot);\n \t\t\tif (tn)\n-\t\t\t\tstrbuf_addstr(oi->typename, tn);\n+\t\t\t\tstrbuf_addstr(oi->type_name, tn);\n \t\t}\n \t\tif (ptot < 0) {\n \t\t\ttype = OBJ_BAD;\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 3da70ac65..2c03458ea 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1087,8 +1087,8 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,\n \t}\n \n \ttype = type_from_string_gently(type_buf, type_len, 1);\n-\tif (oi->typename)\n-\t\tstrbuf_add(oi->typename, type_buf, type_len);\n+\tif (oi->type_name)\n+\t\tstrbuf_add(oi->type_name, type_buf, type_len);\n \t/*\n \t * Set type to 0 if its an unknown object and\n \t * we're obtaining the type using '--allow-unknown-type'\n@@ -1158,7 +1158,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,\n \t * return value implicitly indicates whether the\n \t * object even exists.\n \t */\n-\tif (!oi->typep && !oi->typename && !oi->sizep && !oi->contentp) {\n+\tif (!oi->typep && !oi->type_name && !oi->sizep && !oi->contentp) {\n \t\tconst char *path;\n \t\tstruct stat st;\n \t\tif (stat_sha1_file(sha1, &st, &path) < 0)\n@@ -1239,8 +1239,8 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\t\t\t*(oi->disk_sizep) = 0;\n \t\t\tif (oi->delta_base_sha1)\n \t\t\t\thashclr(oi->delta_base_sha1);\n-\t\t\tif (oi->typename)\n-\t\t\t\tstrbuf_addstr(oi->typename, typename(co->type));\n+\t\t\tif (oi->type_name)\n+\t\t\t\tstrbuf_addstr(oi->type_name, typename(co->type));\n \t\t\tif (oi->contentp)\n \t\t\t\t*oi->contentp = xmemdupz(co->buf, co->size);\n \t\t\toi->whence = OI_CACHED;\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339347","messageId":"20180214185959.221906-3-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 02/37] object: rename function 'typename' to 'type_name'","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:24Z","receivedAt":"2018-02-14T19:00:56Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/cat-file.c                     |  2 +-\n builtin/diff-tree.c                    |  2 +-\n builtin/fast-export.c                  |  8 ++++----\n builtin/fsck.c                         |  4 ++--\n builtin/grep.c                         |  2 +-\n builtin/index-pack.c                   | 12 ++++++------\n builtin/merge.c                        |  2 +-\n builtin/mktree.c                       |  4 ++--\n builtin/prune.c                        |  2 +-\n builtin/replace.c                      | 12 ++++++------\n builtin/tag.c                          |  2 +-\n builtin/unpack-objects.c               | 10 +++++-----\n builtin/verify-commit.c                |  2 +-\n bulk-checkin.c                         |  2 +-\n commit.c                               |  2 +-\n contrib/examples/builtin-fetch--tool.c |  2 +-\n fast-import.c                          | 16 ++++++++--------\n fsck.c                                 |  2 +-\n http-push.c                            |  2 +-\n log-tree.c                             |  2 +-\n object.c                               |  6 +++---\n object.h                               |  2 +-\n pack-check.c                           |  2 +-\n packfile.c                             |  2 +-\n reachable.c                            |  2 +-\n ref-filter.c                           |  4 ++--\n sequencer.c                            |  2 +-\n sha1_file.c                            | 20 ++++++++++----------\n sha1_name.c                            |  6 +++---\n submodule.c                            |  2 +-\n tag.c                                  |  2 +-\n walker.c                               |  4 ++--\n 32 files changed, 73 insertions(+), 73 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex d06c66c77..c6b3b1bfb 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -229,7 +229,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,\n \t\tif (data->mark_query)\n \t\t\tdata->info.typep = &data->type;\n \t\telse\n-\t\t\tstrbuf_addstr(sb, typename(data->type));\n+\t\t\tstrbuf_addstr(sb, type_name(data->type));\n \t} else if (is_atom(\"objectsize\", atom, len)) {\n \t\tif (data->mark_query)\n \t\t\tdata->info.sizep = &data->size;\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex b775a7564..473615117 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -76,7 +76,7 @@ static int diff_tree_stdin(char *line)\n \tif (obj->type == OBJ_TREE)\n \t\treturn stdin_diff_trees((struct tree *)obj, p);\n \terror(\"Object %s is a %s, not a commit or tree\",\n-\t      oid_to_hex(&oid), typename(obj->type));\n+\t      oid_to_hex(&oid), type_name(obj->type));\n \treturn -1;\n }\n \ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 796d0cd66..27b2cc138 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid)\n \t\tbuf = read_sha1_file(oid->hash, &type, &size);\n \t\tif (!buf)\n \t\t\tdie (\"Could not read blob %s\", oid_to_hex(oid));\n-\t\tif (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)\n+\t\tif (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0)\n \t\t\tdie(\"sha1 mismatch in blob %s\", oid_to_hex(oid));\n \t\tobject = parse_object_buffer(oid, type, size, buf, &eaten);\n \t}\n@@ -757,7 +757,7 @@ static void handle_tag(const char *name, struct tag *tag)\n \t\t\tif (tagged->type != OBJ_COMMIT) {\n \t\t\t\tdie (\"Tag %s tags unexported %s!\",\n \t\t\t\t     oid_to_hex(&tag->object.oid),\n-\t\t\t\t     typename(tagged->type));\n+\t\t\t\t     type_name(tagged->type));\n \t\t\t}\n \t\t\tp = (struct commit *)tagged;\n \t\t\tfor (;;) {\n@@ -839,7 +839,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)\n \t\tif (!commit) {\n \t\t\twarning(\"%s: Unexpected object of type %s, skipping.\",\n \t\t\t\te->name,\n-\t\t\t\ttypename(e->item->type));\n+\t\t\t\ttype_name(e->item->type));\n \t\t\tcontinue;\n \t\t}\n \n@@ -851,7 +851,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)\n \t\t\tcontinue;\n \t\tdefault: /* OBJ_TAG (nested tags) is already handled */\n \t\t\twarning(\"Tag points to object of unexpected type %s, skipping.\",\n-\t\t\t\ttypename(commit->object.type));\n+\t\t\t\ttype_name(commit->object.type));\n \t\t\tcontinue;\n \t\t}\n \ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 04846d46f..246237e81 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -70,7 +70,7 @@ static const char *printable_type(struct object *obj)\n \t\t\tobject_as_type(obj, type, 0);\n \t}\n \n-\tret = typename(obj->type);\n+\tret = type_name(obj->type);\n \tif (!ret)\n \t\tret = \"unknown\";\n \n@@ -137,7 +137,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt\n \t\tprintf(\"broken link from %7s %s\\n\",\n \t\t\t   printable_type(parent), describe_object(parent));\n \t\tprintf(\"broken link from %7s %s\\n\",\n-\t\t\t   (type == OBJ_ANY ? \"unknown\" : typename(type)), \"unknown\");\n+\t\t\t   (type == OBJ_ANY ? \"unknown\" : type_name(type)), \"unknown\");\n \t\terrors_found |= ERROR_REACHABLE;\n \t\treturn 1;\n \t}\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 3ca4ac80d..eb1207095 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -627,7 +627,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,\n \t\tfree(data);\n \t\treturn hit;\n \t}\n-\tdie(_(\"unable to grep from object of type %s\"), typename(obj->type));\n+\tdie(_(\"unable to grep from object of type %s\"), type_name(obj->type));\n }\n \n static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 4c51aec81..8b87090e2 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -228,7 +228,7 @@ static unsigned check_object(struct object *obj)\n \t\tif (type != obj->type)\n \t\t\tdie(_(\"object %s: expected type %s, found %s\"),\n \t\t\t    oid_to_hex(&obj->oid),\n-\t\t\t    typename(obj->type), typename(type));\n+\t\t\t    type_name(obj->type), type_name(type));\n \t\tobj->flags |= FLAG_CHECKED;\n \t\treturn 1;\n \t}\n@@ -448,7 +448,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,\n \tint hdrlen;\n \n \tif (!is_delta_type(type)) {\n-\t\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(type), size) + 1;\n+\t\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(type), size) + 1;\n \t\tgit_SHA1_Init(&c);\n \t\tgit_SHA1_Update(&c, hdr, hdrlen);\n \t} else\n@@ -849,7 +849,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,\n \t\t\tobj = parse_object_buffer(oid, type, size, buf,\n \t\t\t\t\t\t  &eaten);\n \t\t\tif (!obj)\n-\t\t\t\tdie(_(\"invalid %s\"), typename(type));\n+\t\t\t\tdie(_(\"invalid %s\"), type_name(type));\n \t\t\tif (do_fsck_object &&\n \t\t\t    fsck_object(obj, buf, size, &fsck_options))\n \t\t\t\tdie(_(\"Error in object\"));\n@@ -959,7 +959,7 @@ static void resolve_delta(struct object_entry *delta_obj,\n \tif (!result->data)\n \t\tbad_object(delta_obj->idx.offset, _(\"failed to apply delta\"));\n \thash_sha1_file(result->data, result->size,\n-\t\t       typename(delta_obj->real_type),\n+\t\t       type_name(delta_obj->real_type),\n \t\t       delta_obj->idx.oid.hash);\n \tsha1_object(result->data, NULL, result->size, delta_obj->real_type,\n \t\t    &delta_obj->idx.oid);\n@@ -1379,7 +1379,7 @@ static void fix_unresolved_deltas(struct sha1file *f)\n \t\t\tcontinue;\n \n \t\tif (check_sha1_signature(d->sha1, base_obj->data,\n-\t\t\t\tbase_obj->size, typename(type)))\n+\t\t\t\tbase_obj->size, type_name(type)))\n \t\t\tdie(_(\"local object %s is corrupt\"), sha1_to_hex(d->sha1));\n \t\tbase_obj->obj = append_obj_to_pack(f, d->sha1,\n \t\t\t\t\tbase_obj->data, base_obj->size, type);\n@@ -1588,7 +1588,7 @@ static void show_pack_info(int stat_only)\n \t\t\tcontinue;\n \t\tprintf(\"%s %-6s %lu %lu %\"PRIuMAX,\n \t\t       oid_to_hex(&obj->idx.oid),\n-\t\t       typename(obj->real_type), obj->size,\n+\t\t       type_name(obj->real_type), obj->size,\n \t\t       (unsigned long)(obj[1].idx.offset - obj->idx.offset),\n \t\t       (uintmax_t)obj->idx.offset);\n \t\tif (is_delta_type(obj->type)) {\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 30264cfd7..9dec14096 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -520,7 +520,7 @@ static void merge_name(const char *remote, struct strbuf *msg)\n \t\tif (desc && desc->obj && desc->obj->type == OBJ_TAG) {\n \t\t\tstrbuf_addf(msg, \"%s\\t\\t%s '%s'\\n\",\n \t\t\t\t    oid_to_hex(&desc->obj->oid),\n-\t\t\t\t    typename(desc->obj->type),\n+\t\t\t\t    type_name(desc->obj->type),\n \t\t\t\t    remote);\n \t\t\tgoto cleanup;\n \t\t}\ndiff --git a/builtin/mktree.c b/builtin/mktree.c\nindex da0fd8cd7..b7b1cb51f 100644\n--- a/builtin/mktree.c\n+++ b/builtin/mktree.c\n@@ -112,7 +112,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss\n \tmode_type = object_type(mode);\n \tif (mode_type != type_from_string(ptr)) {\n \t\tdie(\"entry '%s' object type (%s) doesn't match mode type (%s)\",\n-\t\t\tpath, ptr, typename(mode_type));\n+\t\t\tpath, ptr, type_name(mode_type));\n \t}\n \n \t/* Check the type of object identified by sha1 */\n@@ -131,7 +131,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss\n \t\t\t * because the new tree entry will never be correct.\n \t\t\t */\n \t\t\tdie(\"entry '%s' object %s is a %s but specified type was (%s)\",\n-\t\t\t\tpath, sha1_to_hex(sha1), typename(obj_type), typename(mode_type));\n+\t\t\t\tpath, sha1_to_hex(sha1), type_name(obj_type), type_name(mode_type));\n \t\t}\n \t}\n \ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex d2fdae680..c175f154e 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -52,7 +52,7 @@ static int prune_object(const struct object_id *oid, const char *fullpath,\n \tif (show_only || verbose) {\n \t\tenum object_type type = sha1_object_info(oid->hash, NULL);\n \t\tprintf(\"%s %s\\n\", oid_to_hex(oid),\n-\t\t       (type > 0) ? typename(type) : \"unknown\");\n+\t\t       (type > 0) ? type_name(type) : \"unknown\");\n \t}\n \tif (!show_only)\n \t\tunlink_or_warn(fullpath);\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 10078ae37..42cf4f62a 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -56,8 +56,8 @@ static int show_reference(const char *refname, const struct object_id *oid,\n \t\t\tobj_type = sha1_object_info(object.hash, NULL);\n \t\t\trepl_type = sha1_object_info(oid->hash, NULL);\n \n-\t\t\tprintf(\"%s (%s) -> %s (%s)\\n\", refname, typename(obj_type),\n-\t\t\t       oid_to_hex(oid), typename(repl_type));\n+\t\t\tprintf(\"%s (%s) -> %s (%s)\\n\", refname, type_name(obj_type),\n+\t\t\t       oid_to_hex(oid), type_name(repl_type));\n \t\t}\n \t}\n \n@@ -168,8 +168,8 @@ static int replace_object_oid(const char *object_ref,\n \t\tdie(\"Objects must be of the same type.\\n\"\n \t\t    \"'%s' points to a replaced object of type '%s'\\n\"\n \t\t    \"while '%s' points to a replacement object of type '%s'.\",\n-\t\t    object_ref, typename(obj_type),\n-\t\t    replace_ref, typename(repl_type));\n+\t\t    object_ref, type_name(obj_type),\n+\t\t    replace_ref, type_name(repl_type));\n \n \tcheck_ref_valid(object, &prev, &ref, force);\n \n@@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,\n \targv_array_push(&cmd.args, \"--no-replace-objects\");\n \targv_array_push(&cmd.args, \"cat-file\");\n \tif (raw)\n-\t\targv_array_push(&cmd.args, typename(type));\n+\t\targv_array_push(&cmd.args, type_name(type));\n \telse\n \t\targv_array_push(&cmd.args, \"-p\");\n \targv_array_push(&cmd.args, oid_to_hex(oid));\n@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,\n \tstruct tag *tag;\n \tint i;\n \n-\thash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);\n+\thash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);\n \ttag = lookup_tag(&tag_oid);\n \tif (!tag)\n \t\tdie(_(\"bad mergetag in commit '%s'\"), ref);\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex a7e6a5b0f..7e0881fba 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -220,7 +220,7 @@ static void create_tag(const struct object_id *object, const char *tag,\n \t\t    \"tag %s\\n\"\n \t\t    \"tagger %s\\n\\n\",\n \t\t    oid_to_hex(object),\n-\t\t    typename(type),\n+\t\t    type_name(type),\n \t\t    tag,\n \t\t    git_committer_info(IDENT_STRICT));\n \ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 62ea264c4..e93079070 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -172,7 +172,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)\n {\n \tstruct object_id oid;\n \n-\tif (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0)\n+\tif (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)\n \t\tdie(\"failed to write object %s\", oid_to_hex(&obj->oid));\n \tobj->flags |= FLAG_WRITTEN;\n }\n@@ -237,14 +237,14 @@ static void write_object(unsigned nr, enum object_type type,\n \t\t\t void *buf, unsigned long size)\n {\n \tif (!strict) {\n-\t\tif (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)\n+\t\tif (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)\n \t\t\tdie(\"failed to write object\");\n \t\tadded_object(nr, type, buf, size);\n \t\tfree(buf);\n \t\tobj_list[nr].obj = NULL;\n \t} else if (type == OBJ_BLOB) {\n \t\tstruct blob *blob;\n-\t\tif (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)\n+\t\tif (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)\n \t\t\tdie(\"failed to write object\");\n \t\tadded_object(nr, type, buf, size);\n \t\tfree(buf);\n@@ -258,12 +258,12 @@ static void write_object(unsigned nr, enum object_type type,\n \t} else {\n \t\tstruct object *obj;\n \t\tint eaten;\n-\t\thash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);\n+\t\thash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);\n \t\tadded_object(nr, type, buf, size);\n \t\tobj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,\n \t\t\t\t\t  &eaten);\n \t\tif (!obj)\n-\t\t\tdie(\"invalid %s\", typename(type));\n+\t\t\tdie(\"invalid %s\", type_name(type));\n \t\tadd_object_buffer(obj, buf, size);\n \t\tobj->flags |= FLAG_OPEN;\n \t\tobj_list[nr].obj = obj;\ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex ba38ac9b1..05315ea7c 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -49,7 +49,7 @@ static int verify_commit(const char *name, unsigned flags)\n \t\treturn error(\"%s: unable to read file.\", name);\n \tif (type != OBJ_COMMIT)\n \t\treturn error(\"%s: cannot verify a non-commit object of type %s.\",\n-\t\t\t\tname, typename(type));\n+\t\t\t\tname, type_name(type));\n \n \tret = run_gpg_verify(&oid, buf, size, flags);\n \ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex 3310fd210..bb788494f 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -203,7 +203,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,\n \t\treturn error(\"cannot find the current offset\");\n \n \theader_len = xsnprintf((char *)obuf, sizeof(obuf), \"%s %\" PRIuMAX,\n-\t\t\t       typename(type), (uintmax_t)size) + 1;\n+\t\t\t       type_name(type), (uintmax_t)size) + 1;\n \tgit_SHA1_Init(&ctx);\n \tgit_SHA1_Update(&ctx, obuf, header_len);\n \ndiff --git a/commit.c b/commit.c\nindex ff51c9f34..cd9ace105 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -274,7 +274,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)\n \t\t\t    oid_to_hex(&commit->object.oid));\n \t\tif (type != OBJ_COMMIT)\n \t\t\tdie(\"expected commit for %s, got %s\",\n-\t\t\t    oid_to_hex(&commit->object.oid), typename(type));\n+\t\t\t    oid_to_hex(&commit->object.oid), type_name(type));\n \t\tif (sizep)\n \t\t\t*sizep = size;\n \t}\ndiff --git a/contrib/examples/builtin-fetch--tool.c b/contrib/examples/builtin-fetch--tool.c\nindex a3eb19de0..22648c3af 100644\n--- a/contrib/examples/builtin-fetch--tool.c\n+++ b/contrib/examples/builtin-fetch--tool.c\n@@ -15,7 +15,7 @@ static char *get_stdin(void)\n \n static void show_new(enum object_type type, unsigned char *sha1_new)\n {\n-\tfprintf(stderr, \"  %s: %s\\n\", typename(type),\n+\tfprintf(stderr, \"  %s: %s\\n\", type_name(type),\n \t\tfind_unique_abbrev(sha1_new, DEFAULT_ABBREV));\n }\n \ndiff --git a/fast-import.c b/fast-import.c\nindex b70ac025e..92b89d191 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1096,7 +1096,7 @@ static int store_object(\n \tgit_zstream s;\n \n \thdrlen = xsnprintf((char *)hdr, sizeof(hdr), \"%s %lu\",\n-\t\t\t   typename(type), (unsigned long)dat->len) + 1;\n+\t\t\t   type_name(type), (unsigned long)dat->len) + 1;\n \tgit_SHA1_Init(&c);\n \tgit_SHA1_Update(&c, hdr, hdrlen);\n \tgit_SHA1_Update(&c, dat->buf, dat->len);\n@@ -2421,7 +2421,7 @@ static void file_change_m(const char *p, struct branch *b)\n \t\telse if (oe) {\n \t\t\tif (oe->type != OBJ_COMMIT)\n \t\t\t\tdie(\"Not a commit (actually a %s): %s\",\n-\t\t\t\t\ttypename(oe->type), command_buf.buf);\n+\t\t\t\t\ttype_name(oe->type), command_buf.buf);\n \t\t}\n \t\t/*\n \t\t * Accept the sha1 without checking; it expected to be in\n@@ -2448,7 +2448,7 @@ static void file_change_m(const char *p, struct branch *b)\n \t\t\t\t\tcommand_buf.buf);\n \t\tif (type != expected)\n \t\t\tdie(\"Not a %s (actually a %s): %s\",\n-\t\t\t\ttypename(expected), typename(type),\n+\t\t\t\ttype_name(expected), type_name(type),\n \t\t\t\tcommand_buf.buf);\n \t}\n \n@@ -2599,14 +2599,14 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa\n \t} else if (oe) {\n \t\tif (oe->type != OBJ_BLOB)\n \t\t\tdie(\"Not a blob (actually a %s): %s\",\n-\t\t\t\ttypename(oe->type), command_buf.buf);\n+\t\t\t\ttype_name(oe->type), command_buf.buf);\n \t} else if (!is_null_oid(&oid)) {\n \t\tenum object_type type = sha1_object_info(oid.hash, NULL);\n \t\tif (type < 0)\n \t\t\tdie(\"Blob not found: %s\", command_buf.buf);\n \t\tif (type != OBJ_BLOB)\n \t\t\tdie(\"Not a blob (actually a %s): %s\",\n-\t\t\t    typename(type), command_buf.buf);\n+\t\t\t    type_name(type), command_buf.buf);\n \t}\n \n \tconstruct_path_with_fanout(oid_to_hex(&commit_oid), *old_fanout, path);\n@@ -2914,7 +2914,7 @@ static void parse_new_tag(const char *arg)\n \t\t    \"object %s\\n\"\n \t\t    \"type %s\\n\"\n \t\t    \"tag %s\\n\",\n-\t\t    oid_to_hex(&oid), typename(type), t->name);\n+\t\t    oid_to_hex(&oid), type_name(type), t->name);\n \tif (tagger)\n \t\tstrbuf_addf(&new_data,\n \t\t\t    \"tagger %s\\n\", tagger);\n@@ -2985,10 +2985,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)\n \t\tdie(\"Can't read object %s\", oid_to_hex(oid));\n \tif (type != OBJ_BLOB)\n \t\tdie(\"Object %s is a %s but a blob was expected.\",\n-\t\t    oid_to_hex(oid), typename(type));\n+\t\t    oid_to_hex(oid), type_name(type));\n \tstrbuf_reset(&line);\n \tstrbuf_addf(&line, \"%s %s %lu\\n\", oid_to_hex(oid),\n-\t\t\t\t\t\ttypename(type), size);\n+\t\t\t\t\t\ttype_name(type), size);\n \tcat_blob_write(line.buf, line.len);\n \tstrbuf_release(&line);\n \tcat_blob_write(buf, size);\ndiff --git a/fsck.c b/fsck.c\nindex 032699e9a..5c8c12dde 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -821,7 +821,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,\n \t\t\tret = report(options, &tag->object,\n \t\t\t\tFSCK_MSG_TAG_OBJECT_NOT_TAG,\n \t\t\t\t\"expected tag got %s\",\n-\t\t\t    typename(type));\n+\t\t\t    type_name(type));\n \t\t\tgoto done;\n \t\t}\n \t}\ndiff --git a/http-push.c b/http-push.c\nindex 14435ab65..8814aa12e 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -362,7 +362,7 @@ static void start_put(struct transfer_request *request)\n \tgit_zstream stream;\n \n \tunpacked = read_sha1_file(request->obj->oid.hash, &type, &len);\n-\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(type), len) + 1;\n+\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(type), len) + 1;\n \n \t/* Set it up */\n \tgit_deflate_init(&stream, zlib_compression_level);\ndiff --git a/log-tree.c b/log-tree.c\nindex fca29d479..2eeddbeb3 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -499,7 +499,7 @@ static void show_one_mergetag(struct commit *commit,\n \tint status, nth;\n \tsize_t payload_size, gpg_message_offset;\n \n-\thash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);\n+\thash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);\n \ttag = lookup_tag(&oid);\n \tif (!tag)\n \t\treturn; /* error message already given */\ndiff --git a/object.c b/object.c\nindex 0afdfd19b..0db33b26b 100644\n--- a/object.c\n+++ b/object.c\n@@ -26,7 +26,7 @@ static const char *object_type_strings[] = {\n \t\"tag\",\t\t/* OBJ_TAG = 4 */\n };\n \n-const char *typename(unsigned int type)\n+const char *type_name(unsigned int type)\n {\n \tif (type >= ARRAY_SIZE(object_type_strings))\n \t\treturn NULL;\n@@ -166,7 +166,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)\n \t\tif (!quiet)\n \t\t\terror(\"object %s is a %s, not a %s\",\n \t\t\t      oid_to_hex(&obj->oid),\n-\t\t\t      typename(obj->type), typename(type));\n+\t\t\t      type_name(obj->type), type_name(type));\n \t\treturn NULL;\n \t}\n }\n@@ -265,7 +265,7 @@ struct object *parse_object(const struct object_id *oid)\n \n \tbuffer = read_sha1_file(oid->hash, &type, &size);\n \tif (buffer) {\n-\t\tif (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {\n+\t\tif (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {\n \t\t\tfree(buffer);\n \t\t\terror(\"sha1 mismatch %s\", sha1_to_hex(repl));\n \t\t\treturn NULL;\ndiff --git a/object.h b/object.h\nindex 87563d905..a5eb26380 100644\n--- a/object.h\n+++ b/object.h\n@@ -53,7 +53,7 @@ struct object {\n \tstruct object_id oid;\n };\n \n-extern const char *typename(unsigned int type);\n+extern const char *type_name(unsigned int type);\n extern int type_from_string_gently(const char *str, ssize_t, int gentle);\n #define type_from_string(str) type_from_string_gently(str, -1, 0)\n \ndiff --git a/pack-check.c b/pack-check.c\nindex 073c1fbd4..bd348592f 100644\n--- a/pack-check.c\n+++ b/pack-check.c\n@@ -141,7 +141,7 @@ static int verify_packfile(struct packed_git *p,\n \t\t\terr = error(\"cannot unpack %s from %s at offset %\"PRIuMAX\"\",\n \t\t\t\t    oid_to_hex(entries[i].oid.oid), p->pack_name,\n \t\t\t\t    (uintmax_t)entries[i].offset);\n-\t\telse if (check_sha1_signature(entries[i].oid.hash, data, size, typename(type)))\n+\t\telse if (check_sha1_signature(entries[i].oid.hash, data, size, type_name(type)))\n \t\t\terr = error(\"packed %s from %s is corrupt\",\n \t\t\t\t    oid_to_hex(entries[i].oid.oid), p->pack_name);\n \t\telse if (fn) {\ndiff --git a/packfile.c b/packfile.c\nindex 6657a0a49..0532a371b 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1357,7 +1357,7 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,\n \t\tif (oi->typep)\n \t\t\t*oi->typep = ptot;\n \t\tif (oi->type_name) {\n-\t\t\tconst char *tn = typename(ptot);\n+\t\t\tconst char *tn = type_name(ptot);\n \t\t\tif (tn)\n \t\t\t\tstrbuf_addstr(oi->type_name, tn);\n \t\t}\ndiff --git a/reachable.c b/reachable.c\nindex 88d7d679d..191ebe3e6 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -94,7 +94,7 @@ static void add_recent_object(const struct object_id *oid,\n \t\tbreak;\n \tdefault:\n \t\tdie(\"unknown object type for %s: %s\",\n-\t\t    oid_to_hex(oid), typename(type));\n+\t\t    oid_to_hex(oid), type_name(type));\n \t}\n \n \tif (!obj)\ndiff --git a/ref-filter.c b/ref-filter.c\nindex f9e25aea7..9dae6cfe3 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -769,7 +769,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object\n \t\tif (deref)\n \t\t\tname++;\n \t\tif (!strcmp(name, \"objecttype\"))\n-\t\t\tv->s = typename(obj->type);\n+\t\t\tv->s = type_name(obj->type);\n \t\telse if (!strcmp(name, \"objectsize\")) {\n \t\t\tv->value = sz;\n \t\t\tv->s = xstrfmt(\"%lu\", sz);\n@@ -795,7 +795,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob\n \t\tif (!strcmp(name, \"tag\"))\n \t\t\tv->s = tag->tag;\n \t\telse if (!strcmp(name, \"type\") && tag->tagged)\n-\t\t\tv->s = typename(tag->tagged->type);\n+\t\t\tv->s = type_name(tag->tagged->type);\n \t\telse if (!strcmp(name, \"object\") && tag->tagged)\n \t\t\tv->s = xstrdup(oid_to_hex(&tag->tagged->oid));\n \t}\ndiff --git a/sequencer.c b/sequencer.c\nindex 4d3f60594..f6b77e6bd 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2348,7 +2348,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)\n \t\t\tif (!lookup_commit_reference_gently(&oid, 1)) {\n \t\t\t\tenum object_type type = sha1_object_info(oid.hash, NULL);\n \t\t\t\treturn error(_(\"%s: can't cherry-pick a %s\"),\n-\t\t\t\t\tname, typename(type));\n+\t\t\t\t\tname, type_name(type));\n \t\t\t}\n \t\t} else\n \t\t\treturn error(_(\"%s: bad revision\"), name);\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 2c03458ea..2288bb75c 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -805,7 +805,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,\n \t\treturn -1;\n \n \t/* Generate the header */\n-\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(obj_type), size) + 1;\n+\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(obj_type), size) + 1;\n \n \t/* Sha1.. */\n \tgit_SHA1_Init(&c);\n@@ -1240,7 +1240,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\t\tif (oi->delta_base_sha1)\n \t\t\t\thashclr(oi->delta_base_sha1);\n \t\t\tif (oi->type_name)\n-\t\t\t\tstrbuf_addstr(oi->type_name, typename(co->type));\n+\t\t\t\tstrbuf_addstr(oi->type_name, type_name(co->type));\n \t\t\tif (oi->contentp)\n \t\t\t\t*oi->contentp = xmemdupz(co->buf, co->size);\n \t\t\toi->whence = OI_CACHED;\n@@ -1317,7 +1317,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,\n {\n \tstruct cached_object *co;\n \n-\thash_sha1_file(buf, len, typename(type), sha1);\n+\thash_sha1_file(buf, len, type_name(type), sha1);\n \tif (has_sha1_file(sha1) || find_cached_object(sha1))\n \t\treturn 0;\n \tALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);\n@@ -1683,7 +1683,7 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)\n \tbuf = read_object(sha1, &type, &len);\n \tif (!buf)\n \t\treturn error(\"cannot read sha1_file for %s\", sha1_to_hex(sha1));\n-\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", typename(type), len) + 1;\n+\thdrlen = xsnprintf(hdr, sizeof(hdr), \"%s %lu\", type_name(type), len) + 1;\n \tret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);\n \tfree(buf);\n \n@@ -1767,9 +1767,9 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,\n \t}\n \n \tif (write_object)\n-\t\tret = write_sha1_file(buf, size, typename(type), oid->hash);\n+\t\tret = write_sha1_file(buf, size, type_name(type), oid->hash);\n \telse\n-\t\tret = hash_sha1_file(buf, size, typename(type), oid->hash);\n+\t\tret = hash_sha1_file(buf, size, type_name(type), oid->hash);\n \tif (re_allocated)\n \t\tfree(buf);\n \treturn ret;\n@@ -1789,10 +1789,10 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,\n \t\t\t\t get_safe_crlf(flags));\n \n \tif (write_object)\n-\t\tret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),\n+\t\tret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),\n \t\t\t\t      oid->hash);\n \telse\n-\t\tret = hash_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),\n+\t\tret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),\n \t\t\t\t     oid->hash);\n \tstrbuf_release(&sbuf);\n \treturn ret;\n@@ -1942,7 +1942,7 @@ void assert_sha1_type(const unsigned char *sha1, enum object_type expect)\n \t\tdie(\"%s is not a valid object\", sha1_to_hex(sha1));\n \tif (type != expect)\n \t\tdie(\"%s is not a valid '%s' object\", sha1_to_hex(sha1),\n-\t\t    typename(expect));\n+\t\t    type_name(expect));\n }\n \n int for_each_file_in_obj_subdir(unsigned int subdir_nr,\n@@ -2187,7 +2187,7 @@ int read_loose_object(const char *path,\n \t\t\tgoto out;\n \t\t}\n \t\tif (check_sha1_signature(expected_sha1, *contents,\n-\t\t\t\t\t *size, typename(*type))) {\n+\t\t\t\t\t *size, type_name(*type))) {\n \t\t\terror(\"sha1 mismatch for %s (expected %s)\", path,\n \t\t\t      sha1_to_hex(expected_sha1));\n \t\t\tfree(*contents);\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 611c7d24d..e7c18ffc2 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -381,7 +381,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)\n \n \tadvise(\"  %s %s%s\",\n \t       find_unique_abbrev(oid->hash, DEFAULT_ABBREV),\n-\t       typename(type) ? typename(type) : \"unknown type\",\n+\t       type_name(type) ? type_name(type) : \"unknown type\",\n \t       desc.buf);\n \n \tstrbuf_release(&desc);\n@@ -901,8 +901,8 @@ struct object *peel_to_type(const char *name, int namelen,\n \t\t\tif (name)\n \t\t\t\terror(\"%.*s: expected %s type, but the object \"\n \t\t\t\t      \"dereferences to %s type\",\n-\t\t\t\t      namelen, name, typename(expected_type),\n-\t\t\t\t      typename(o->type));\n+\t\t\t\t      namelen, name, type_name(expected_type),\n+\t\t\t\t      type_name(o->type));\n \t\t\treturn NULL;\n \t\t}\n \t}\ndiff --git a/submodule.c b/submodule.c\nindex 47ddc9b27..cd18400e8 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -831,7 +831,7 @@ static int check_has_commit(const struct object_id *oid, void *data)\n \t\treturn 0;\n \tdefault:\n \t\tdie(_(\"submodule entry '%s' (%s) is a %s, not a commit\"),\n-\t\t    cb->path, oid_to_hex(oid), typename(type));\n+\t\t    cb->path, oid_to_hex(oid), type_name(type));\n \t}\n }\n \ndiff --git a/tag.c b/tag.c\nindex fcbe012f7..66210fd47 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -47,7 +47,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\t\t\tname_to_report ?\n \t\t\t\tname_to_report :\n \t\t\t\tfind_unique_abbrev(oid->hash, DEFAULT_ABBREV),\n-\t\t\t\ttypename(type));\n+\t\t\t\ttype_name(type));\n \n \tbuf = read_sha1_file(oid->hash, &type, &size);\n \tif (!buf)\ndiff --git a/walker.c b/walker.c\nindex 5d4d3733f..dffb9c8e3 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -22,7 +22,7 @@ void walker_say(struct walker *walker, const char *fmt, ...)\n static void report_missing(const struct object *obj)\n {\n \tfprintf(stderr, \"Cannot obtain needed %s %s\\n\",\n-\t\tobj->type ? typename(obj->type): \"object\",\n+\t\tobj->type ? type_name(obj->type): \"object\",\n \t\toid_to_hex(&obj->oid));\n \tif (!is_null_oid(&current_commit_oid))\n \t\tfprintf(stderr, \"while processing commit %s.\\n\",\n@@ -134,7 +134,7 @@ static int process_object(struct walker *walker, struct object *obj)\n \t}\n \treturn error(\"Unable to determine requirements \"\n \t\t     \"of type %s for %s\",\n-\t\t     typename(obj->type), oid_to_hex(&obj->oid));\n+\t\t     type_name(obj->type), oid_to_hex(&obj->oid));\n }\n \n static int process(struct walker *walker, struct object *obj)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339348","messageId":"20180214185959.221906-5-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 04/37] pack-objects: rename 'this' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:26Z","receivedAt":"2018-02-14T19:01:01Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/pack-objects.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 6b9cfc289..bfda8602c 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1376,10 +1376,10 @@ static void cleanup_preferred_base(void)\n \tit = pbase_tree;\n \tpbase_tree = NULL;\n \twhile (it) {\n-\t\tstruct pbase_tree *this = it;\n-\t\tit = this->next;\n-\t\tfree(this->pcache.tree_data);\n-\t\tfree(this);\n+\t\tstruct pbase_tree *tmp = it;\n+\t\tit = tmp->next;\n+\t\tfree(tmp->pcache.tree_data);\n+\t\tfree(tmp);\n \t}\n \n \tfor (i = 0; i < ARRAY_SIZE(pbase_tree_cache); i++) {\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339349","messageId":"20180214185959.221906-4-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 03/37] blame: rename 'this' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:25Z","receivedAt":"2018-02-14T19:01:03Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n blame.c | 33 +++++++++++++++++----------------\n 1 file changed, 17 insertions(+), 16 deletions(-)\n\ndiff --git a/blame.c b/blame.c\nindex 2893f3c10..21c867664 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -998,28 +998,29 @@ unsigned blame_entry_score(struct blame_scoreboard *sb, struct blame_entry *e)\n }\n \n /*\n- * best_so_far[] and this[] are both a split of an existing blame_entry\n- * that passes blame to the parent.  Maintain best_so_far the best split\n- * so far, by comparing this and best_so_far and copying this into\n+ * best_so_far[] and potential[] are both a split of an existing blame_entry\n+ * that passes blame to the parent.  Maintain best_so_far the best split so\n+ * far, by comparing potential and best_so_far and copying potential into\n  * bst_so_far as needed.\n  */\n static void copy_split_if_better(struct blame_scoreboard *sb,\n \t\t\t\t struct blame_entry *best_so_far,\n-\t\t\t\t struct blame_entry *this)\n+\t\t\t\t struct blame_entry *potential)\n {\n \tint i;\n \n-\tif (!this[1].suspect)\n+\tif (!potential[1].suspect)\n \t\treturn;\n \tif (best_so_far[1].suspect) {\n-\t\tif (blame_entry_score(sb, &this[1]) < blame_entry_score(sb, &best_so_far[1]))\n+\t\tif (blame_entry_score(sb, &potential[1]) <\n+\t\t    blame_entry_score(sb, &best_so_far[1]))\n \t\t\treturn;\n \t}\n \n \tfor (i = 0; i < 3; i++)\n-\t\tblame_origin_incref(this[i].suspect);\n+\t\tblame_origin_incref(potential[i].suspect);\n \tdecref_split(best_so_far);\n-\tmemcpy(best_so_far, this, sizeof(struct blame_entry [3]));\n+\tmemcpy(best_so_far, potential, sizeof(struct blame_entry[3]));\n }\n \n /*\n@@ -1046,12 +1047,12 @@ static void handle_split(struct blame_scoreboard *sb,\n \tif (ent->num_lines <= tlno)\n \t\treturn;\n \tif (tlno < same) {\n-\t\tstruct blame_entry this[3];\n+\t\tstruct blame_entry potential[3];\n \t\ttlno += ent->s_lno;\n \t\tsame += ent->s_lno;\n-\t\tsplit_overlap(this, ent, tlno, plno, same, parent);\n-\t\tcopy_split_if_better(sb, split, this);\n-\t\tdecref_split(this);\n+\t\tsplit_overlap(potential, ent, tlno, plno, same, parent);\n+\t\tcopy_split_if_better(sb, split, potential);\n+\t\tdecref_split(potential);\n \t}\n }\n \n@@ -1273,7 +1274,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,\n \t\t\tstruct diff_filepair *p = diff_queued_diff.queue[i];\n \t\t\tstruct blame_origin *norigin;\n \t\t\tmmfile_t file_p;\n-\t\t\tstruct blame_entry this[3];\n+\t\t\tstruct blame_entry potential[3];\n \n \t\t\tif (!DIFF_FILE_VALID(p->one))\n \t\t\t\tcontinue; /* does not exist in parent */\n@@ -1292,10 +1293,10 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,\n \n \t\t\tfor (j = 0; j < num_ents; j++) {\n \t\t\t\tfind_copy_in_blob(sb, blame_list[j].ent,\n-\t\t\t\t\t\t  norigin, this, &file_p);\n+\t\t\t\t\t\t  norigin, potential, &file_p);\n \t\t\t\tcopy_split_if_better(sb, blame_list[j].split,\n-\t\t\t\t\t\t     this);\n-\t\t\t\tdecref_split(this);\n+\t\t\t\t\t\t     potential);\n+\t\t\t\tdecref_split(potential);\n \t\t\t}\n \t\t\tblame_origin_decref(norigin);\n \t\t}\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339350","messageId":"20180214185959.221906-6-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 05/37] rev-parse: rename 'this' variable","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:27Z","receivedAt":"2018-02-14T19:01:05Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/rev-parse.c | 34 +++++++++++++++++-----------------\n 1 file changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 74aa644cb..171c7a2b4 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -243,28 +243,28 @@ static int show_file(const char *arg, int output_prefix)\n static int try_difference(const char *arg)\n {\n \tchar *dotdot;\n-\tstruct object_id oid;\n-\tstruct object_id end;\n-\tconst char *next;\n-\tconst char *this;\n+\tstruct object_id start_oid;\n+\tstruct object_id end_oid;\n+\tconst char *end;\n+\tconst char *start;\n \tint symmetric;\n \tstatic const char head_by_default[] = \"HEAD\";\n \n \tif (!(dotdot = strstr(arg, \"..\")))\n \t\treturn 0;\n-\tnext = dotdot + 2;\n-\tthis = arg;\n-\tsymmetric = (*next == '.');\n+\tend = dotdot + 2;\n+\tstart = arg;\n+\tsymmetric = (*end == '.');\n \n \t*dotdot = 0;\n-\tnext += symmetric;\n+\tend += symmetric;\n \n-\tif (!*next)\n-\t\tnext = head_by_default;\n+\tif (!*end)\n+\t\tend = head_by_default;\n \tif (dotdot == arg)\n-\t\tthis = head_by_default;\n+\t\tstart = head_by_default;\n \n-\tif (this == head_by_default && next == head_by_default &&\n+\tif (start == head_by_default && end == head_by_default &&\n \t    !symmetric) {\n \t\t/*\n \t\t * Just \"..\"?  That is not a range but the\n@@ -274,14 +274,14 @@ static int try_difference(const char *arg)\n \t\treturn 0;\n \t}\n \n-\tif (!get_oid_committish(this, &oid) && !get_oid_committish(next, &end)) {\n-\t\tshow_rev(NORMAL, &end, next);\n-\t\tshow_rev(symmetric ? NORMAL : REVERSED, &oid, this);\n+\tif (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {\n+\t\tshow_rev(NORMAL, &end_oid, end);\n+\t\tshow_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);\n \t\tif (symmetric) {\n \t\t\tstruct commit_list *exclude;\n \t\t\tstruct commit *a, *b;\n-\t\t\ta = lookup_commit_reference(&oid);\n-\t\t\tb = lookup_commit_reference(&end);\n+\t\t\ta = lookup_commit_reference(&start_oid);\n+\t\t\tb = lookup_commit_reference(&end_oid);\n \t\t\texclude = get_merge_bases(a, b);\n \t\t\twhile (exclude) {\n \t\t\t\tstruct commit *commit = pop_commit(&exclude);\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339351","messageId":"20180214185959.221906-7-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 06/37] diff: rename 'this' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:28Z","receivedAt":"2018-02-14T19:01:09Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 0a9a0cdf1..d682d0d1f 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n \twhile (dir->nr) {\n \t\tstruct dirstat_file *f = dir->files;\n \t\tint namelen = strlen(f->name);\n-\t\tunsigned long this;\n+\t\tunsigned long sum;\n \t\tchar *slash;\n \n \t\tif (namelen < baselen)\n@@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n \t\tslash = strchr(f->name + baselen, '/');\n \t\tif (slash) {\n \t\t\tint newbaselen = slash + 1 - f->name;\n-\t\t\tthis = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n+\t\t\tsum = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n \t\t\tsources++;\n \t\t} else {\n-\t\t\tthis = f->changed;\n+\t\t\tsum = f->changed;\n \t\t\tdir->files++;\n \t\t\tdir->nr--;\n \t\t\tsources += 2;\n \t\t}\n-\t\tthis_dir += this;\n+\t\tthis_dir += sum;\n \t}\n \n \t/*\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339353","messageId":"20180214185959.221906-10-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 09/37] checkout: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:31Z","receivedAt":"2018-02-14T19:01:15Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/checkout.c | 196 ++++++++++++++++++++++-----------------------\n 1 file changed, 98 insertions(+), 98 deletions(-)\n\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex c54c78df5..ed3d655f2 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -54,14 +54,14 @@ struct checkout_opts {\n \tstruct tree *source_tree;\n };\n \n-static int post_checkout_hook(struct commit *old, struct commit *new,\n+static int post_checkout_hook(struct commit *old_commit, struct commit *new_commit,\n \t\t\t      int changed)\n {\n \treturn run_hook_le(NULL, \"post-checkout\",\n-\t\t\t   oid_to_hex(old ? &old->object.oid : &null_oid),\n-\t\t\t   oid_to_hex(new ? &new->object.oid : &null_oid),\n+\t\t\t   oid_to_hex(old_commit ? &old_commit->object.oid : &null_oid),\n+\t\t\t   oid_to_hex(new_commit ? &new_commit->object.oid : &null_oid),\n \t\t\t   changed ? \"1\" : \"0\", NULL);\n-\t/* \"new\" can be NULL when checking out from the index before\n+\t/* \"new_commit\" can be NULL when checking out from the index before\n \t   a commit exists. */\n \n }\n@@ -472,8 +472,8 @@ static void setup_branch_path(struct branch_info *branch)\n }\n \n static int merge_working_tree(const struct checkout_opts *opts,\n-\t\t\t      struct branch_info *old,\n-\t\t\t      struct branch_info *new,\n+\t\t\t      struct branch_info *old_branch_info,\n+\t\t\t      struct branch_info *new_branch_info,\n \t\t\t      int *writeout_error)\n {\n \tint ret;\n@@ -485,7 +485,7 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \n \tresolve_undo_clear();\n \tif (opts->force) {\n-\t\tret = reset_tree(new->commit->tree, opts, 1, writeout_error);\n+\t\tret = reset_tree(new_branch_info->commit->tree, opts, 1, writeout_error);\n \t\tif (ret)\n \t\t\treturn ret;\n \t} else {\n@@ -511,7 +511,7 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\ttopts.initial_checkout = is_cache_unborn();\n \t\ttopts.update = 1;\n \t\ttopts.merge = 1;\n-\t\ttopts.gently = opts->merge && old->commit;\n+\t\ttopts.gently = opts->merge && old_branch_info->commit;\n \t\ttopts.verbose_update = opts->show_progress;\n \t\ttopts.fn = twoway_merge;\n \t\tif (opts->overwrite_ignore) {\n@@ -519,11 +519,11 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\ttopts.dir->flags |= DIR_SHOW_IGNORED;\n \t\t\tsetup_standard_excludes(topts.dir);\n \t\t}\n-\t\ttree = parse_tree_indirect(old->commit ?\n-\t\t\t\t\t   &old->commit->object.oid :\n+\t\ttree = parse_tree_indirect(old_branch_info->commit ?\n+\t\t\t\t\t   &old_branch_info->commit->object.oid :\n \t\t\t\t\t   the_hash_algo->empty_tree);\n \t\tinit_tree_desc(&trees[0], tree->buffer, tree->size);\n-\t\ttree = parse_tree_indirect(&new->commit->object.oid);\n+\t\ttree = parse_tree_indirect(&new_branch_info->commit->object.oid);\n \t\tinit_tree_desc(&trees[1], tree->buffer, tree->size);\n \n \t\tret = unpack_trees(2, trees, &topts);\n@@ -540,10 +540,10 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\t\treturn 1;\n \n \t\t\t/*\n-\t\t\t * Without old->commit, the below is the same as\n+\t\t\t * Without old_branch_info->commit, the below is the same as\n \t\t\t * the two-tree unpack we already tried and failed.\n \t\t\t */\n-\t\t\tif (!old->commit)\n+\t\t\tif (!old_branch_info->commit)\n \t\t\t\treturn 1;\n \n \t\t\t/* Do more real merge */\n@@ -571,18 +571,18 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\to.verbosity = 0;\n \t\t\twork = write_tree_from_memory(&o);\n \n-\t\t\tret = reset_tree(new->commit->tree, opts, 1,\n+\t\t\tret = reset_tree(new_branch_info->commit->tree, opts, 1,\n \t\t\t\t\t writeout_error);\n \t\t\tif (ret)\n \t\t\t\treturn ret;\n-\t\t\to.ancestor = old->name;\n-\t\t\to.branch1 = new->name;\n+\t\t\to.ancestor = old_branch_info->name;\n+\t\t\to.branch1 = new_branch_info->name;\n \t\t\to.branch2 = \"local\";\n-\t\t\tret = merge_trees(&o, new->commit->tree, work,\n-\t\t\t\told->commit->tree, &result);\n+\t\t\tret = merge_trees(&o, new_branch_info->commit->tree, work,\n+\t\t\t\told_branch_info->commit->tree, &result);\n \t\t\tif (ret < 0)\n \t\t\t\texit(128);\n-\t\t\tret = reset_tree(new->commit->tree, opts, 0,\n+\t\t\tret = reset_tree(new_branch_info->commit->tree, opts, 0,\n \t\t\t\t\t writeout_error);\n \t\t\tstrbuf_release(&o.obuf);\n \t\t\tif (ret)\n@@ -600,15 +600,15 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\tdie(_(\"unable to write new index file\"));\n \n \tif (!opts->force && !opts->quiet)\n-\t\tshow_local_changes(&new->commit->object, &opts->diff_options);\n+\t\tshow_local_changes(&new_branch_info->commit->object, &opts->diff_options);\n \n \treturn 0;\n }\n \n-static void report_tracking(struct branch_info *new)\n+static void report_tracking(struct branch_info *new_branch_info)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n-\tstruct branch *branch = branch_get(new->name);\n+\tstruct branch *branch = branch_get(new_branch_info->name);\n \n \tif (!format_tracking_info(branch, &sb))\n \t\treturn;\n@@ -617,8 +617,8 @@ static void report_tracking(struct branch_info *new)\n }\n \n static void update_refs_for_switch(const struct checkout_opts *opts,\n-\t\t\t\t   struct branch_info *old,\n-\t\t\t\t   struct branch_info *new)\n+\t\t\t\t   struct branch_info *old_branch_info,\n+\t\t\t\t   struct branch_info *new_branch_info)\n {\n \tstruct strbuf msg = STRBUF_INIT;\n \tconst char *old_desc, *reflog_msg;\n@@ -645,69 +645,69 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \t\t\tfree(refname);\n \t\t}\n \t\telse\n-\t\t\tcreate_branch(opts->new_branch, new->name,\n+\t\t\tcreate_branch(opts->new_branch, new_branch_info->name,\n \t\t\t\t      opts->new_branch_force ? 1 : 0,\n \t\t\t\t      opts->new_branch_force ? 1 : 0,\n \t\t\t\t      opts->new_branch_log,\n \t\t\t\t      opts->quiet,\n \t\t\t\t      opts->track);\n-\t\tnew->name = opts->new_branch;\n-\t\tsetup_branch_path(new);\n+\t\tnew_branch_info->name = opts->new_branch;\n+\t\tsetup_branch_path(new_branch_info);\n \t}\n \n-\told_desc = old->name;\n-\tif (!old_desc && old->commit)\n-\t\told_desc = oid_to_hex(&old->commit->object.oid);\n+\told_desc = old_branch_info->name;\n+\tif (!old_desc && old_branch_info->commit)\n+\t\told_desc = oid_to_hex(&old_branch_info->commit->object.oid);\n \n \treflog_msg = getenv(\"GIT_REFLOG_ACTION\");\n \tif (!reflog_msg)\n \t\tstrbuf_addf(&msg, \"checkout: moving from %s to %s\",\n-\t\t\told_desc ? old_desc : \"(invalid)\", new->name);\n+\t\t\told_desc ? old_desc : \"(invalid)\", new_branch_info->name);\n \telse\n \t\tstrbuf_insert(&msg, 0, reflog_msg, strlen(reflog_msg));\n \n-\tif (!strcmp(new->name, \"HEAD\") && !new->path && !opts->force_detach) {\n+\tif (!strcmp(new_branch_info->name, \"HEAD\") && !new_branch_info->path && !opts->force_detach) {\n \t\t/* Nothing to do. */\n-\t} else if (opts->force_detach || !new->path) {\t/* No longer on any branch. */\n-\t\tupdate_ref(msg.buf, \"HEAD\", &new->commit->object.oid, NULL,\n+\t} else if (opts->force_detach || !new_branch_info->path) {\t/* No longer on any branch. */\n+\t\tupdate_ref(msg.buf, \"HEAD\", &new_branch_info->commit->object.oid, NULL,\n \t\t\t   REF_NO_DEREF, UPDATE_REFS_DIE_ON_ERR);\n \t\tif (!opts->quiet) {\n-\t\t\tif (old->path &&\n+\t\t\tif (old_branch_info->path &&\n \t\t\t    advice_detached_head && !opts->force_detach)\n-\t\t\t\tdetach_advice(new->name);\n-\t\t\tdescribe_detached_head(_(\"HEAD is now at\"), new->commit);\n+\t\t\t\tdetach_advice(new_branch_info->name);\n+\t\t\tdescribe_detached_head(_(\"HEAD is now at\"), new_branch_info->commit);\n \t\t}\n-\t} else if (new->path) {\t/* Switch branches. */\n-\t\tif (create_symref(\"HEAD\", new->path, msg.buf) < 0)\n+\t} else if (new_branch_info->path) {\t/* Switch branches. */\n+\t\tif (create_symref(\"HEAD\", new_branch_info->path, msg.buf) < 0)\n \t\t\tdie(_(\"unable to update HEAD\"));\n \t\tif (!opts->quiet) {\n-\t\t\tif (old->path && !strcmp(new->path, old->path)) {\n+\t\t\tif (old_branch_info->path && !strcmp(new_branch_info->path, old_branch_info->path)) {\n \t\t\t\tif (opts->new_branch_force)\n \t\t\t\t\tfprintf(stderr, _(\"Reset branch '%s'\\n\"),\n-\t\t\t\t\t\tnew->name);\n+\t\t\t\t\t\tnew_branch_info->name);\n \t\t\t\telse\n \t\t\t\t\tfprintf(stderr, _(\"Already on '%s'\\n\"),\n-\t\t\t\t\t\tnew->name);\n+\t\t\t\t\t\tnew_branch_info->name);\n \t\t\t} else if (opts->new_branch) {\n \t\t\t\tif (opts->branch_exists)\n-\t\t\t\t\tfprintf(stderr, _(\"Switched to and reset branch '%s'\\n\"), new->name);\n+\t\t\t\t\tfprintf(stderr, _(\"Switched to and reset branch '%s'\\n\"), new_branch_info->name);\n \t\t\t\telse\n-\t\t\t\t\tfprintf(stderr, _(\"Switched to a new branch '%s'\\n\"), new->name);\n+\t\t\t\t\tfprintf(stderr, _(\"Switched to a new branch '%s'\\n\"), new_branch_info->name);\n \t\t\t} else {\n \t\t\t\tfprintf(stderr, _(\"Switched to branch '%s'\\n\"),\n-\t\t\t\t\tnew->name);\n+\t\t\t\t\tnew_branch_info->name);\n \t\t\t}\n \t\t}\n-\t\tif (old->path && old->name) {\n-\t\t\tif (!ref_exists(old->path) && reflog_exists(old->path))\n-\t\t\t\tdelete_reflog(old->path);\n+\t\tif (old_branch_info->path && old_branch_info->name) {\n+\t\t\tif (!ref_exists(old_branch_info->path) && reflog_exists(old_branch_info->path))\n+\t\t\t\tdelete_reflog(old_branch_info->path);\n \t\t}\n \t}\n \tremove_branch_state();\n \tstrbuf_release(&msg);\n \tif (!opts->quiet &&\n-\t    (new->path || (!opts->force_detach && !strcmp(new->name, \"HEAD\"))))\n-\t\treport_tracking(new);\n+\t    (new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, \"HEAD\"))))\n+\t\treport_tracking(new_branch_info);\n }\n \n static int add_pending_uninteresting_ref(const char *refname,\n@@ -787,10 +787,10 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)\n  * HEAD.  If it is not reachable from any ref, this is the last chance\n  * for the user to do so without resorting to reflog.\n  */\n-static void orphaned_commit_warning(struct commit *old, struct commit *new)\n+static void orphaned_commit_warning(struct commit *old_commit, struct commit *new_commit)\n {\n \tstruct rev_info revs;\n-\tstruct object *object = &old->object;\n+\tstruct object *object = &old_commit->object;\n \n \tinit_revisions(&revs, NULL);\n \tsetup_revisions(0, NULL, &revs, NULL);\n@@ -799,57 +799,57 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)\n \tadd_pending_object(&revs, object, oid_to_hex(&object->oid));\n \n \tfor_each_ref(add_pending_uninteresting_ref, &revs);\n-\tadd_pending_oid(&revs, \"HEAD\", &new->object.oid, UNINTERESTING);\n+\tadd_pending_oid(&revs, \"HEAD\", &new_commit->object.oid, UNINTERESTING);\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(_(\"internal error in revision walk\"));\n-\tif (!(old->object.flags & UNINTERESTING))\n-\t\tsuggest_reattach(old, &revs);\n+\tif (!(old_commit->object.flags & UNINTERESTING))\n+\t\tsuggest_reattach(old_commit, &revs);\n \telse\n-\t\tdescribe_detached_head(_(\"Previous HEAD position was\"), old);\n+\t\tdescribe_detached_head(_(\"Previous HEAD position was\"), old_commit);\n \n \t/* Clean up objects used, as they will be reused. */\n \tclear_commit_marks_all(ALL_REV_FLAGS);\n }\n \n static int switch_branches(const struct checkout_opts *opts,\n-\t\t\t   struct branch_info *new)\n+\t\t\t   struct branch_info *new_branch_info)\n {\n \tint ret = 0;\n-\tstruct branch_info old;\n+\tstruct branch_info old_branch_info;\n \tvoid *path_to_free;\n \tstruct object_id rev;\n \tint flag, writeout_error = 0;\n-\tmemset(&old, 0, sizeof(old));\n-\told.path = path_to_free = resolve_refdup(\"HEAD\", 0, &rev, &flag);\n-\tif (old.path)\n-\t\told.commit = lookup_commit_reference_gently(&rev, 1);\n+\tmemset(&old_branch_info, 0, sizeof(old_branch_info));\n+\told_branch_info.path = path_to_free = resolve_refdup(\"HEAD\", 0, &rev, &flag);\n+\tif (old_branch_info.path)\n+\t\told_branch_info.commit = lookup_commit_reference_gently(&rev, 1);\n \tif (!(flag & REF_ISSYMREF))\n-\t\told.path = NULL;\n+\t\told_branch_info.path = NULL;\n \n-\tif (old.path)\n-\t\tskip_prefix(old.path, \"refs/heads/\", &old.name);\n+\tif (old_branch_info.path)\n+\t\tskip_prefix(old_branch_info.path, \"refs/heads/\", &old_branch_info.name);\n \n-\tif (!new->name) {\n-\t\tnew->name = \"HEAD\";\n-\t\tnew->commit = old.commit;\n-\t\tif (!new->commit)\n+\tif (!new_branch_info->name) {\n+\t\tnew_branch_info->name = \"HEAD\";\n+\t\tnew_branch_info->commit = old_branch_info.commit;\n+\t\tif (!new_branch_info->commit)\n \t\t\tdie(_(\"You are on a branch yet to be born\"));\n-\t\tparse_commit_or_die(new->commit);\n+\t\tparse_commit_or_die(new_branch_info->commit);\n \t}\n \n-\tret = merge_working_tree(opts, &old, new, &writeout_error);\n+\tret = merge_working_tree(opts, &old_branch_info, new_branch_info, &writeout_error);\n \tif (ret) {\n \t\tfree(path_to_free);\n \t\treturn ret;\n \t}\n \n-\tif (!opts->quiet && !old.path && old.commit && new->commit != old.commit)\n-\t\torphaned_commit_warning(old.commit, new->commit);\n+\tif (!opts->quiet && !old_branch_info.path && old_branch_info.commit && new_branch_info->commit != old_branch_info.commit)\n+\t\torphaned_commit_warning(old_branch_info.commit, new_branch_info->commit);\n \n-\tupdate_refs_for_switch(opts, &old, new);\n+\tupdate_refs_for_switch(opts, &old_branch_info, new_branch_info);\n \n-\tret = post_checkout_hook(old.commit, new->commit, 1);\n+\tret = post_checkout_hook(old_branch_info.commit, new_branch_info->commit, 1);\n \tfree(path_to_free);\n \treturn ret || writeout_error;\n }\n@@ -870,7 +870,7 @@ static int git_checkout_config(const char *var, const char *value, void *cb)\n \n static int parse_branchname_arg(int argc, const char **argv,\n \t\t\t\tint dwim_new_local_branch_ok,\n-\t\t\t\tstruct branch_info *new,\n+\t\t\t\tstruct branch_info *new_branch_info,\n \t\t\t\tstruct checkout_opts *opts,\n \t\t\t\tstruct object_id *rev)\n {\n@@ -988,22 +988,22 @@ static int parse_branchname_arg(int argc, const char **argv,\n \targv++;\n \targc--;\n \n-\tnew->name = arg;\n-\tsetup_branch_path(new);\n+\tnew_branch_info->name = arg;\n+\tsetup_branch_path(new_branch_info);\n \n-\tif (!check_refname_format(new->path, 0) &&\n-\t    !read_ref(new->path, &branch_rev))\n+\tif (!check_refname_format(new_branch_info->path, 0) &&\n+\t    !read_ref(new_branch_info->path, &branch_rev))\n \t\toidcpy(rev, &branch_rev);\n \telse\n-\t\tnew->path = NULL; /* not an existing branch */\n+\t\tnew_branch_info->path = NULL; /* not an existing branch */\n \n-\tnew->commit = lookup_commit_reference_gently(rev, 1);\n-\tif (!new->commit) {\n+\tnew_branch_info->commit = lookup_commit_reference_gently(rev, 1);\n+\tif (!new_branch_info->commit) {\n \t\t/* not a commit */\n \t\t*source_tree = parse_tree_indirect(rev);\n \t} else {\n-\t\tparse_commit_or_die(new->commit);\n-\t\t*source_tree = new->commit->tree;\n+\t\tparse_commit_or_die(new_branch_info->commit);\n+\t\t*source_tree = new_branch_info->commit->tree;\n \t}\n \n \tif (!*source_tree)                   /* case (1): want a tree */\n@@ -1043,7 +1043,7 @@ static int switch_unborn_to_new_branch(const struct checkout_opts *opts)\n }\n \n static int checkout_branch(struct checkout_opts *opts,\n-\t\t\t   struct branch_info *new)\n+\t\t\t   struct branch_info *new_branch_info)\n {\n \tif (opts->pathspec.nr)\n \t\tdie(_(\"paths cannot be used with switching branches\"));\n@@ -1072,21 +1072,21 @@ static int checkout_branch(struct checkout_opts *opts,\n \t} else if (opts->track == BRANCH_TRACK_UNSPECIFIED)\n \t\topts->track = git_branch_track;\n \n-\tif (new->name && !new->commit)\n+\tif (new_branch_info->name && !new_branch_info->commit)\n \t\tdie(_(\"Cannot switch branch to a non-commit '%s'\"),\n-\t\t    new->name);\n+\t\t    new_branch_info->name);\n \n-\tif (new->path && !opts->force_detach && !opts->new_branch &&\n+\tif (new_branch_info->path && !opts->force_detach && !opts->new_branch &&\n \t    !opts->ignore_other_worktrees) {\n \t\tint flag;\n \t\tchar *head_ref = resolve_refdup(\"HEAD\", 0, NULL, &flag);\n \t\tif (head_ref &&\n-\t\t    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))\n-\t\t\tdie_if_checked_out(new->path, 1);\n+\t\t    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new_branch_info->path)))\n+\t\t\tdie_if_checked_out(new_branch_info->path, 1);\n \t\tfree(head_ref);\n \t}\n \n-\tif (!new->commit && opts->new_branch) {\n+\tif (!new_branch_info->commit && opts->new_branch) {\n \t\tstruct object_id rev;\n \t\tint flag;\n \n@@ -1094,13 +1094,13 @@ static int checkout_branch(struct checkout_opts *opts,\n \t\t    (flag & REF_ISSYMREF) && is_null_oid(&rev))\n \t\t\treturn switch_unborn_to_new_branch(opts);\n \t}\n-\treturn switch_branches(opts, new);\n+\treturn switch_branches(opts, new_branch_info);\n }\n \n int cmd_checkout(int argc, const char **argv, const char *prefix)\n {\n \tstruct checkout_opts opts;\n-\tstruct branch_info new;\n+\tstruct branch_info new_branch_info;\n \tchar *conflict_style = NULL;\n \tint dwim_new_local_branch = 1;\n \tstruct option options[] = {\n@@ -1138,7 +1138,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t};\n \n \tmemset(&opts, 0, sizeof(opts));\n-\tmemset(&new, 0, sizeof(new));\n+\tmemset(&new_branch_info, 0, sizeof(new_branch_info));\n \topts.overwrite_ignore = 1;\n \topts.prefix = prefix;\n \topts.show_progress = -1;\n@@ -1210,7 +1210,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t\t\topts.track == BRANCH_TRACK_UNSPECIFIED &&\n \t\t\t!opts.new_branch;\n \t\tint n = parse_branchname_arg(argc, argv, dwim_ok,\n-\t\t\t\t\t     &new, &opts, &rev);\n+\t\t\t\t\t     &new_branch_info, &opts, &rev);\n \t\targv += n;\n \t\targc -= n;\n \t}\n@@ -1253,7 +1253,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \n \tUNLEAK(opts);\n \tif (opts.patch_mode || opts.pathspec.nr)\n-\t\treturn checkout_paths(&opts, new.name);\n+\t\treturn checkout_paths(&opts, new_branch_info.name);\n \telse\n-\t\treturn checkout_branch(&opts, &new);\n+\t\treturn checkout_branch(&opts, &new_branch_info);\n }\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339354","messageId":"20180214185959.221906-11-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 10/37] help: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:32Z","receivedAt":"2018-02-14T19:01:17Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/help.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex d3c8fc408..598867cfe 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -194,11 +194,11 @@ static void do_add_man_viewer_info(const char *name,\n \t\t\t\t   size_t len,\n \t\t\t\t   const char *value)\n {\n-\tstruct man_viewer_info_list *new;\n-\tFLEX_ALLOC_MEM(new, name, name, len);\n-\tnew->info = xstrdup(value);\n-\tnew->next = man_viewer_info_list;\n-\tman_viewer_info_list = new;\n+\tstruct man_viewer_info_list *new_man_viewer;\n+\tFLEX_ALLOC_MEM(new_man_viewer, name, name, len);\n+\tnew_man_viewer->info = xstrdup(value);\n+\tnew_man_viewer->next = man_viewer_info_list;\n+\tman_viewer_info_list = new_man_viewer;\n }\n \n static int add_man_viewer_path(const char *name,\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339355","messageId":"20180214185959.221906-12-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 11/37] pack-redundant: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:33Z","receivedAt":"2018-02-14T19:01:19Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/pack-redundant.c | 54 ++++++++++++++++++++--------------------\n 1 file changed, 27 insertions(+), 27 deletions(-)\n\ndiff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c\nindex aaa813632..991e1bb76 100644\n--- a/builtin/pack-redundant.c\n+++ b/builtin/pack-redundant.c\n@@ -48,17 +48,17 @@ static inline void llist_item_put(struct llist_item *item)\n \n static inline struct llist_item *llist_item_get(void)\n {\n-\tstruct llist_item *new;\n+\tstruct llist_item *new_item;\n \tif ( free_nodes ) {\n-\t\tnew = free_nodes;\n+\t\tnew_item = free_nodes;\n \t\tfree_nodes = free_nodes->next;\n \t} else {\n \t\tint i = 1;\n-\t\tALLOC_ARRAY(new, BLKSIZE);\n+\t\tALLOC_ARRAY(new_item, BLKSIZE);\n \t\tfor (; i < BLKSIZE; i++)\n-\t\t\tllist_item_put(&new[i]);\n+\t\t\tllist_item_put(&new_item[i]);\n \t}\n-\treturn new;\n+\treturn new_item;\n }\n \n static void llist_free(struct llist *list)\n@@ -80,26 +80,26 @@ static inline void llist_init(struct llist **list)\n static struct llist * llist_copy(struct llist *list)\n {\n \tstruct llist *ret;\n-\tstruct llist_item *new, *old, *prev;\n+\tstruct llist_item *new_item, *old_item, *prev;\n \n \tllist_init(&ret);\n \n \tif ((ret->size = list->size) == 0)\n \t\treturn ret;\n \n-\tnew = ret->front = llist_item_get();\n-\tnew->sha1 = list->front->sha1;\n+\tnew_item = ret->front = llist_item_get();\n+\tnew_item->sha1 = list->front->sha1;\n \n-\told = list->front->next;\n-\twhile (old) {\n-\t\tprev = new;\n-\t\tnew = llist_item_get();\n-\t\tprev->next = new;\n-\t\tnew->sha1 = old->sha1;\n-\t\told = old->next;\n+\told_item = list->front->next;\n+\twhile (old_item) {\n+\t\tprev = new_item;\n+\t\tnew_item = llist_item_get();\n+\t\tprev->next = new_item;\n+\t\tnew_item->sha1 = old_item->sha1;\n+\t\told_item = old_item->next;\n \t}\n-\tnew->next = NULL;\n-\tret->back = new;\n+\tnew_item->next = NULL;\n+\tret->back = new_item;\n \n \treturn ret;\n }\n@@ -108,24 +108,24 @@ static inline struct llist_item *llist_insert(struct llist *list,\n \t\t\t\t\t      struct llist_item *after,\n \t\t\t\t\t       const unsigned char *sha1)\n {\n-\tstruct llist_item *new = llist_item_get();\n-\tnew->sha1 = sha1;\n-\tnew->next = NULL;\n+\tstruct llist_item *new_item = llist_item_get();\n+\tnew_item->sha1 = sha1;\n+\tnew_item->next = NULL;\n \n \tif (after != NULL) {\n-\t\tnew->next = after->next;\n-\t\tafter->next = new;\n+\t\tnew_item->next = after->next;\n+\t\tafter->next = new_item;\n \t\tif (after == list->back)\n-\t\t\tlist->back = new;\n+\t\t\tlist->back = new_item;\n \t} else {/* insert in front */\n \t\tif (list->size == 0)\n-\t\t\tlist->back = new;\n+\t\t\tlist->back = new_item;\n \t\telse\n-\t\t\tnew->next = list->front;\n-\t\tlist->front = new;\n+\t\t\tnew_item->next = list->front;\n+\t\tlist->front = new_item;\n \t}\n \tlist->size++;\n-\treturn new;\n+\treturn new_item;\n }\n \n static inline struct llist_item *llist_insert_back(struct llist *list,\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339356","messageId":"20180214185959.221906-13-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 12/37] reflog: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:34Z","receivedAt":"2018-02-14T19:01:27Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/reflog.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 223372531..ac3dcd7a5 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -289,20 +289,20 @@ static int should_expire_reflog_ent(struct object_id *ooid, struct object_id *no\n \t\t\t\t    const char *message, void *cb_data)\n {\n \tstruct expire_reflog_policy_cb *cb = cb_data;\n-\tstruct commit *old, *new;\n+\tstruct commit *old_commit, *new_commit;\n \n \tif (timestamp < cb->cmd.expire_total)\n \t\treturn 1;\n \n-\told = new = NULL;\n+\told_commit = new_commit = NULL;\n \tif (cb->cmd.stalefix &&\n-\t    (!keep_entry(&old, ooid) || !keep_entry(&new, noid)))\n+\t    (!keep_entry(&old_commit, ooid) || !keep_entry(&new_commit, noid)))\n \t\treturn 1;\n \n \tif (timestamp < cb->cmd.expire_unreachable) {\n \t\tif (cb->unreachable_expire_kind == UE_ALWAYS)\n \t\t\treturn 1;\n-\t\tif (unreachable(cb, old, ooid) || unreachable(cb, new, noid))\n+\t\tif (unreachable(cb, old_commit, ooid) || unreachable(cb, new_commit, noid))\n \t\t\treturn 1;\n \t}\n \n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339357","messageId":"20180214185959.221906-16-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 15/37] commit: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:37Z","receivedAt":"2018-02-14T19:01:30Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n commit.c | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex cd9ace105..874b6e510 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -861,19 +861,19 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)\n \tcommit_list_insert(in->item, &ret);\n \n \tfor (i = in->next; i; i = i->next) {\n-\t\tstruct commit_list *new = NULL, *end = NULL;\n+\t\tstruct commit_list *new_commits = NULL, *end = NULL;\n \n \t\tfor (j = ret; j; j = j->next) {\n \t\t\tstruct commit_list *bases;\n \t\t\tbases = get_merge_bases(i->item, j->item);\n-\t\t\tif (!new)\n-\t\t\t\tnew = bases;\n+\t\t\tif (!new_commits)\n+\t\t\t\tnew_commits = bases;\n \t\t\telse\n \t\t\t\tend->next = bases;\n \t\t\tfor (k = bases; k; k = k->next)\n \t\t\t\tend = k;\n \t\t}\n-\t\tret = new;\n+\t\tret = new_commits;\n \t}\n \treturn ret;\n }\n@@ -1617,11 +1617,11 @@ struct commit *get_merge_parent(const char *name)\n struct commit_list **commit_list_append(struct commit *commit,\n \t\t\t\t\tstruct commit_list **next)\n {\n-\tstruct commit_list *new = xmalloc(sizeof(struct commit_list));\n-\tnew->item = commit;\n-\t*next = new;\n-\tnew->next = NULL;\n-\treturn &new->next;\n+\tstruct commit_list *new_commit = xmalloc(sizeof(struct commit_list));\n+\tnew_commit->item = commit;\n+\t*next = new_commit;\n+\tnew_commit->next = NULL;\n+\treturn &new_commit->next;\n }\n \n const char *find_commit_header(const char *msg, const char *key, size_t *out_len)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339358","messageId":"20180214185959.221906-17-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 16/37] diff-lib: rename 'new' variable","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:38Z","receivedAt":"2018-02-14T19:01:33Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff-lib.c | 38 +++++++++++++++++++-------------------\n 1 file changed, 19 insertions(+), 19 deletions(-)\n\ndiff --git a/diff-lib.c b/diff-lib.c\nindex 8104603a3..261ce13d6 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -302,7 +302,7 @@ static int get_stat_data(const struct cache_entry *ce,\n }\n \n static void show_new_file(struct rev_info *revs,\n-\t\t\t  const struct cache_entry *new,\n+\t\t\t  const struct cache_entry *new_file,\n \t\t\t  int cached, int match_missing)\n {\n \tconst struct object_id *oid;\n@@ -313,16 +313,16 @@ static void show_new_file(struct rev_info *revs,\n \t * New file in the index: it might actually be different in\n \t * the working tree.\n \t */\n-\tif (get_stat_data(new, &oid, &mode, cached, match_missing,\n+\tif (get_stat_data(new_file, &oid, &mode, cached, match_missing,\n \t    &dirty_submodule, &revs->diffopt) < 0)\n \t\treturn;\n \n-\tdiff_index_show_file(revs, \"+\", new, oid, !is_null_oid(oid), mode, dirty_submodule);\n+\tdiff_index_show_file(revs, \"+\", new_file, oid, !is_null_oid(oid), mode, dirty_submodule);\n }\n \n static int show_modified(struct rev_info *revs,\n-\t\t\t const struct cache_entry *old,\n-\t\t\t const struct cache_entry *new,\n+\t\t\t const struct cache_entry *old_entry,\n+\t\t\t const struct cache_entry *new_entry,\n \t\t\t int report_missing,\n \t\t\t int cached, int match_missing)\n {\n@@ -330,47 +330,47 @@ static int show_modified(struct rev_info *revs,\n \tconst struct object_id *oid;\n \tunsigned dirty_submodule = 0;\n \n-\tif (get_stat_data(new, &oid, &mode, cached, match_missing,\n+\tif (get_stat_data(new_entry, &oid, &mode, cached, match_missing,\n \t\t\t  &dirty_submodule, &revs->diffopt) < 0) {\n \t\tif (report_missing)\n-\t\t\tdiff_index_show_file(revs, \"-\", old,\n-\t\t\t\t\t     &old->oid, 1, old->ce_mode,\n+\t\t\tdiff_index_show_file(revs, \"-\", old_entry,\n+\t\t\t\t\t     &old_entry->oid, 1, old_entry->ce_mode,\n \t\t\t\t\t     0);\n \t\treturn -1;\n \t}\n \n \tif (revs->combine_merges && !cached &&\n-\t    (oidcmp(oid, &old->oid) || oidcmp(&old->oid, &new->oid))) {\n+\t    (oidcmp(oid, &old_entry->oid) || oidcmp(&old_entry->oid, &new_entry->oid))) {\n \t\tstruct combine_diff_path *p;\n-\t\tint pathlen = ce_namelen(new);\n+\t\tint pathlen = ce_namelen(new_entry);\n \n \t\tp = xmalloc(combine_diff_path_size(2, pathlen));\n \t\tp->path = (char *) &p->parent[2];\n \t\tp->next = NULL;\n-\t\tmemcpy(p->path, new->name, pathlen);\n+\t\tmemcpy(p->path, new_entry->name, pathlen);\n \t\tp->path[pathlen] = 0;\n \t\tp->mode = mode;\n \t\toidclr(&p->oid);\n \t\tmemset(p->parent, 0, 2 * sizeof(struct combine_diff_parent));\n \t\tp->parent[0].status = DIFF_STATUS_MODIFIED;\n-\t\tp->parent[0].mode = new->ce_mode;\n-\t\toidcpy(&p->parent[0].oid, &new->oid);\n+\t\tp->parent[0].mode = new_entry->ce_mode;\n+\t\toidcpy(&p->parent[0].oid, &new_entry->oid);\n \t\tp->parent[1].status = DIFF_STATUS_MODIFIED;\n-\t\tp->parent[1].mode = old->ce_mode;\n-\t\toidcpy(&p->parent[1].oid, &old->oid);\n+\t\tp->parent[1].mode = old_entry->ce_mode;\n+\t\toidcpy(&p->parent[1].oid, &old_entry->oid);\n \t\tshow_combined_diff(p, 2, revs->dense_combined_merges, revs);\n \t\tfree(p);\n \t\treturn 0;\n \t}\n \n-\toldmode = old->ce_mode;\n-\tif (mode == oldmode && !oidcmp(oid, &old->oid) && !dirty_submodule &&\n+\toldmode = old_entry->ce_mode;\n+\tif (mode == oldmode && !oidcmp(oid, &old_entry->oid) && !dirty_submodule &&\n \t    !revs->diffopt.flags.find_copies_harder)\n \t\treturn 0;\n \n \tdiff_change(&revs->diffopt, oldmode, mode,\n-\t\t    &old->oid, oid, 1, !is_null_oid(oid),\n-\t\t    old->name, 0, dirty_submodule);\n+\t\t    &old_entry->oid, oid, 1, !is_null_oid(oid),\n+\t\t    old_entry->name, 0, dirty_submodule);\n \treturn 0;\n }\n \n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339359","messageId":"20180214185959.221906-19-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 18/37] diffcore-delta: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:40Z","receivedAt":"2018-02-14T19:01:38Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diffcore-delta.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/diffcore-delta.c b/diffcore-delta.c\nindex ebe70fb06..c83d45a04 100644\n--- a/diffcore-delta.c\n+++ b/diffcore-delta.c\n@@ -48,16 +48,16 @@ struct spanhash_top {\n \n static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)\n {\n-\tstruct spanhash_top *new;\n+\tstruct spanhash_top *new_spanhash;\n \tint i;\n \tint osz = 1 << orig->alloc_log2;\n \tint sz = osz << 1;\n \n-\tnew = xmalloc(st_add(sizeof(*orig),\n+\tnew_spanhash = xmalloc(st_add(sizeof(*orig),\n \t\t\t     st_mult(sizeof(struct spanhash), sz)));\n-\tnew->alloc_log2 = orig->alloc_log2 + 1;\n-\tnew->free = INITIAL_FREE(new->alloc_log2);\n-\tmemset(new->data, 0, sizeof(struct spanhash) * sz);\n+\tnew_spanhash->alloc_log2 = orig->alloc_log2 + 1;\n+\tnew_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);\n+\tmemset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);\n \tfor (i = 0; i < osz; i++) {\n \t\tstruct spanhash *o = &(orig->data[i]);\n \t\tint bucket;\n@@ -65,11 +65,11 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)\n \t\t\tcontinue;\n \t\tbucket = o->hashval & (sz - 1);\n \t\twhile (1) {\n-\t\t\tstruct spanhash *h = &(new->data[bucket++]);\n+\t\t\tstruct spanhash *h = &(new_spanhash->data[bucket++]);\n \t\t\tif (!h->cnt) {\n \t\t\t\th->hashval = o->hashval;\n \t\t\t\th->cnt = o->cnt;\n-\t\t\t\tnew->free--;\n+\t\t\t\tnew_spanhash->free--;\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\tif (sz <= bucket)\n@@ -77,7 +77,7 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)\n \t\t}\n \t}\n \tfree(orig);\n-\treturn new;\n+\treturn new_spanhash;\n }\n \n static struct spanhash_top *add_spanhash(struct spanhash_top *top,\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339360","messageId":"20180214185959.221906-20-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 19/37] entry: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:41Z","receivedAt":"2018-02-14T19:01:41Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n entry.c | 40 ++++++++++++++++++++--------------------\n 1 file changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/entry.c b/entry.c\nindex 30211447a..6c33112ae 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -85,12 +85,12 @@ static int create_file(const char *path, unsigned int mode)\n static void *read_blob_entry(const struct cache_entry *ce, unsigned long *size)\n {\n \tenum object_type type;\n-\tvoid *new = read_sha1_file(ce->oid.hash, &type, size);\n+\tvoid *blob_data = read_sha1_file(ce->oid.hash, &type, size);\n \n-\tif (new) {\n+\tif (blob_data) {\n \t\tif (type == OBJ_BLOB)\n-\t\t\treturn new;\n-\t\tfree(new);\n+\t\t\treturn blob_data;\n+\t\tfree(blob_data);\n \t}\n \treturn NULL;\n }\n@@ -256,7 +256,7 @@ static int write_entry(struct cache_entry *ce,\n \tunsigned int ce_mode_s_ifmt = ce->ce_mode & S_IFMT;\n \tstruct delayed_checkout *dco = state->delayed_checkout;\n \tint fd, ret, fstat_done = 0;\n-\tchar *new;\n+\tchar *new_blob;\n \tstruct strbuf buf = STRBUF_INIT;\n \tunsigned long size;\n \tssize_t wrote;\n@@ -276,8 +276,8 @@ static int write_entry(struct cache_entry *ce,\n \n \tswitch (ce_mode_s_ifmt) {\n \tcase S_IFLNK:\n-\t\tnew = read_blob_entry(ce, &size);\n-\t\tif (!new)\n+\t\tnew_blob = read_blob_entry(ce, &size);\n+\t\tif (!new_blob)\n \t\t\treturn error(\"unable to read sha1 file of %s (%s)\",\n \t\t\t\t     path, oid_to_hex(&ce->oid));\n \n@@ -288,8 +288,8 @@ static int write_entry(struct cache_entry *ce,\n \t\tif (!has_symlinks || to_tempfile)\n \t\t\tgoto write_file_entry;\n \n-\t\tret = symlink(new, path);\n-\t\tfree(new);\n+\t\tret = symlink(new_blob, path);\n+\t\tfree(new_blob);\n \t\tif (ret)\n \t\t\treturn error_errno(\"unable to create symlink %s\", path);\n \t\tbreak;\n@@ -300,11 +300,11 @@ static int write_entry(struct cache_entry *ce,\n \t\t * bother reading it at all.\n \t\t */\n \t\tif (dco && dco->state == CE_RETRY) {\n-\t\t\tnew = NULL;\n+\t\t\tnew_blob = NULL;\n \t\t\tsize = 0;\n \t\t} else {\n-\t\t\tnew = read_blob_entry(ce, &size);\n-\t\t\tif (!new)\n+\t\t\tnew_blob = read_blob_entry(ce, &size);\n+\t\t\tif (!new_blob)\n \t\t\t\treturn error(\"unable to read sha1 file of %s (%s)\",\n \t\t\t\t\t     path, oid_to_hex(&ce->oid));\n \t\t}\n@@ -313,18 +313,18 @@ static int write_entry(struct cache_entry *ce,\n \t\t * Convert from git internal format to working tree format\n \t\t */\n \t\tif (dco && dco->state != CE_NO_DELAY) {\n-\t\t\tret = async_convert_to_working_tree(ce->name, new,\n+\t\t\tret = async_convert_to_working_tree(ce->name, new_blob,\n \t\t\t\t\t\t\t    size, &buf, dco);\n \t\t\tif (ret && string_list_has_string(&dco->paths, ce->name)) {\n-\t\t\t\tfree(new);\n+\t\t\t\tfree(new_blob);\n \t\t\t\tgoto delayed;\n \t\t\t}\n \t\t} else\n-\t\t\tret = convert_to_working_tree(ce->name, new, size, &buf);\n+\t\t\tret = convert_to_working_tree(ce->name, new_blob, size, &buf);\n \n \t\tif (ret) {\n-\t\t\tfree(new);\n-\t\t\tnew = strbuf_detach(&buf, &newsize);\n+\t\t\tfree(new_blob);\n+\t\t\tnew_blob = strbuf_detach(&buf, &newsize);\n \t\t\tsize = newsize;\n \t\t}\n \t\t/*\n@@ -336,15 +336,15 @@ static int write_entry(struct cache_entry *ce,\n \twrite_file_entry:\n \t\tfd = open_output_fd(path, ce, to_tempfile);\n \t\tif (fd < 0) {\n-\t\t\tfree(new);\n+\t\t\tfree(new_blob);\n \t\t\treturn error_errno(\"unable to create file %s\", path);\n \t\t}\n \n-\t\twrote = write_in_full(fd, new, size);\n+\t\twrote = write_in_full(fd, new_blob, size);\n \t\tif (!to_tempfile)\n \t\t\tfstat_done = fstat_output(fd, state, &st);\n \t\tclose(fd);\n-\t\tfree(new);\n+\t\tfree(new_blob);\n \t\tif (wrote < 0)\n \t\t\treturn error(\"unable to write file %s\", path);\n \t\tbreak;\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339361","messageId":"20180214185959.221906-21-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 20/37] http: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:42Z","receivedAt":"2018-02-14T19:01:44Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n http.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 597771271..41cfa41a9 100644\n--- a/http.c\n+++ b/http.c\n@@ -1194,14 +1194,14 @@ static struct fill_chain *fill_cfg;\n \n void add_fill_function(void *data, int (*fill)(void *))\n {\n-\tstruct fill_chain *new = xmalloc(sizeof(*new));\n+\tstruct fill_chain *new_fill = xmalloc(sizeof(*new_fill));\n \tstruct fill_chain **linkp = &fill_cfg;\n-\tnew->data = data;\n-\tnew->fill = fill;\n-\tnew->next = NULL;\n+\tnew_fill->data = data;\n+\tnew_fill->fill = fill;\n+\tnew_fill->next = NULL;\n \twhile (*linkp)\n \t\tlinkp = &(*linkp)->next;\n-\t*linkp = new;\n+\t*linkp = new_fill;\n }\n \n void fill_active_slots(void)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339362","messageId":"20180214185959.221906-22-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 21/37] imap-send: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:43Z","receivedAt":"2018-02-14T19:01:47Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n imap-send.c | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 36c7c1b4f..ffb0a6eca 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -1189,11 +1189,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f\n  */\n static void lf_to_crlf(struct strbuf *msg)\n {\n-\tchar *new;\n+\tchar *new_msg;\n \tsize_t i, j;\n \tchar lastc;\n \n-\t/* First pass: tally, in j, the size of the new string: */\n+\t/* First pass: tally, in j, the size of the new_msg string: */\n \tfor (i = j = 0, lastc = '\\0'; i < msg->len; i++) {\n \t\tif (msg->buf[i] == '\\n' && lastc != '\\r')\n \t\t\tj++; /* a CR will need to be added here */\n@@ -1201,18 +1201,18 @@ static void lf_to_crlf(struct strbuf *msg)\n \t\tj++;\n \t}\n \n-\tnew = xmallocz(j);\n+\tnew_msg = xmallocz(j);\n \n \t/*\n-\t * Second pass: write the new string.  Note that this loop is\n+\t * Second pass: write the new_msg string.  Note that this loop is\n \t * otherwise identical to the first pass.\n \t */\n \tfor (i = j = 0, lastc = '\\0'; i < msg->len; i++) {\n \t\tif (msg->buf[i] == '\\n' && lastc != '\\r')\n-\t\t\tnew[j++] = '\\r';\n-\t\tlastc = new[j++] = msg->buf[i];\n+\t\t\tnew_msg[j++] = '\\r';\n+\t\tlastc = new_msg[j++] = msg->buf[i];\n \t}\n-\tstrbuf_attach(msg, new, j, j + 1);\n+\tstrbuf_attach(msg, new_msg, j, j + 1);\n }\n \n /*\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339363","messageId":"20180214185959.221906-23-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 22/37] line-log: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:44Z","receivedAt":"2018-02-14T19:01:51Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n line-log.c | 56 +++++++++++++++++++++++++++---------------------------\n 1 file changed, 28 insertions(+), 28 deletions(-)\n\ndiff --git a/line-log.c b/line-log.c\nindex 545ad0f28..cdc2257db 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -151,29 +151,29 @@ static void range_set_union(struct range_set *out,\n \n \tassert(out->nr == 0);\n \twhile (i < a->nr || j < b->nr) {\n-\t\tstruct range *new;\n+\t\tstruct range *new_range;\n \t\tif (i < a->nr && j < b->nr) {\n \t\t\tif (ra[i].start < rb[j].start)\n-\t\t\t\tnew = &ra[i++];\n+\t\t\t\tnew_range = &ra[i++];\n \t\t\telse if (ra[i].start > rb[j].start)\n-\t\t\t\tnew = &rb[j++];\n+\t\t\t\tnew_range = &rb[j++];\n \t\t\telse if (ra[i].end < rb[j].end)\n-\t\t\t\tnew = &ra[i++];\n+\t\t\t\tnew_range = &ra[i++];\n \t\t\telse\n-\t\t\t\tnew = &rb[j++];\n+\t\t\t\tnew_range = &rb[j++];\n \t\t} else if (i < a->nr)      /* b exhausted */\n-\t\t\tnew = &ra[i++];\n+\t\t\tnew_range = &ra[i++];\n \t\telse                       /* a exhausted */\n-\t\t\tnew = &rb[j++];\n-\t\tif (new->start == new->end)\n+\t\t\tnew_range = &rb[j++];\n+\t\tif (new_range->start == new_range->end)\n \t\t\t; /* empty range */\n-\t\telse if (!out->nr || out->ranges[out->nr-1].end < new->start) {\n+\t\telse if (!out->nr || out->ranges[out->nr-1].end < new_range->start) {\n \t\t\trange_set_grow(out, 1);\n-\t\t\tout->ranges[out->nr].start = new->start;\n-\t\t\tout->ranges[out->nr].end = new->end;\n+\t\t\tout->ranges[out->nr].start = new_range->start;\n+\t\t\tout->ranges[out->nr].end = new_range->end;\n \t\t\tout->nr++;\n-\t\t} else if (out->ranges[out->nr-1].end < new->end) {\n-\t\t\tout->ranges[out->nr-1].end = new->end;\n+\t\t} else if (out->ranges[out->nr-1].end < new_range->end) {\n+\t\t\tout->ranges[out->nr-1].end = new_range->end;\n \t\t}\n \t}\n }\n@@ -696,18 +696,18 @@ static struct line_log_data *line_log_data_merge(struct line_log_data *a,\n static void add_line_range(struct rev_info *revs, struct commit *commit,\n \t\t\t   struct line_log_data *range)\n {\n-\tstruct line_log_data *old = NULL;\n-\tstruct line_log_data *new = NULL;\n+\tstruct line_log_data *old_line = NULL;\n+\tstruct line_log_data *new_line = NULL;\n \n-\told = lookup_decoration(&revs->line_log_data, &commit->object);\n-\tif (old && range) {\n-\t\tnew = line_log_data_merge(old, range);\n-\t\tfree_line_log_data(old);\n+\told_line = lookup_decoration(&revs->line_log_data, &commit->object);\n+\tif (old_line && range) {\n+\t\tnew_line = line_log_data_merge(old_line, range);\n+\t\tfree_line_log_data(old_line);\n \t} else if (range)\n-\t\tnew = line_log_data_copy(range);\n+\t\tnew_line = line_log_data_copy(range);\n \n-\tif (new)\n-\t\tadd_decoration(&revs->line_log_data, &commit->object, new);\n+\tif (new_line)\n+\t\tadd_decoration(&revs->line_log_data, &commit->object, new_line);\n }\n \n static void clear_commit_line_range(struct rev_info *revs, struct commit *commit)\n@@ -1042,12 +1042,12 @@ static int process_diff_filepair(struct rev_info *rev,\n \n static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair)\n {\n-\tstruct diff_filepair *new = xmalloc(sizeof(struct diff_filepair));\n-\tnew->one = pair->one;\n-\tnew->two = pair->two;\n-\tnew->one->count++;\n-\tnew->two->count++;\n-\treturn new;\n+\tstruct diff_filepair *new_filepair = xmalloc(sizeof(struct diff_filepair));\n+\tnew_filepair->one = pair->one;\n+\tnew_filepair->two = pair->two;\n+\tnew_filepair->one->count++;\n+\tnew_filepair->two->count++;\n+\treturn new_filepair;\n }\n \n static void free_diffqueues(int n, struct diff_queue_struct *dq)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339364","messageId":"20180214185959.221906-24-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 23/37] read-cache: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:45Z","receivedAt":"2018-02-14T19:01:53Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n read-cache.c | 40 ++++++++++++++++++++--------------------\n 1 file changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex 2eb81a66b..b22668bfa 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -70,20 +70,20 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache\n \n void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)\n {\n-\tstruct cache_entry *old = istate->cache[nr], *new;\n+\tstruct cache_entry *old_entry = istate->cache[nr], *new_entry;\n \tint namelen = strlen(new_name);\n \n-\tnew = xmalloc(cache_entry_size(namelen));\n-\tcopy_cache_entry(new, old);\n-\tnew->ce_flags &= ~CE_HASHED;\n-\tnew->ce_namelen = namelen;\n-\tnew->index = 0;\n-\tmemcpy(new->name, new_name, namelen + 1);\n+\tnew_entry = xmalloc(cache_entry_size(namelen));\n+\tcopy_cache_entry(new_entry, old_entry);\n+\tnew_entry->ce_flags &= ~CE_HASHED;\n+\tnew_entry->ce_namelen = namelen;\n+\tnew_entry->index = 0;\n+\tmemcpy(new_entry->name, new_name, namelen + 1);\n \n-\tcache_tree_invalidate_path(istate, old->name);\n-\tuntracked_cache_remove_from_index(istate, old->name);\n+\tcache_tree_invalidate_path(istate, old_entry->name);\n+\tuntracked_cache_remove_from_index(istate, old_entry->name);\n \tremove_index_entry_at(istate, nr);\n-\tadd_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);\n+\tadd_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);\n }\n \n void fill_stat_data(struct stat_data *sd, struct stat *st)\n@@ -615,18 +615,18 @@ static struct cache_entry *create_alias_ce(struct index_state *istate,\n \t\t\t\t\t   struct cache_entry *alias)\n {\n \tint len;\n-\tstruct cache_entry *new;\n+\tstruct cache_entry *new_entry;\n \n \tif (alias->ce_flags & CE_ADDED)\n \t\tdie(\"Will not add file alias '%s' ('%s' already exists in index)\", ce->name, alias->name);\n \n \t/* Ok, create the new entry using the name of the existing alias */\n \tlen = ce_namelen(alias);\n-\tnew = xcalloc(1, cache_entry_size(len));\n-\tmemcpy(new->name, alias->name, len);\n-\tcopy_cache_entry(new, ce);\n+\tnew_entry = xcalloc(1, cache_entry_size(len));\n+\tmemcpy(new_entry->name, alias->name, len);\n+\tcopy_cache_entry(new_entry, ce);\n \tsave_or_free_index_entry(istate, ce);\n-\treturn new;\n+\treturn new_entry;\n }\n \n void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)\n@@ -1379,7 +1379,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,\n \tadded_fmt = (in_porcelain ? \"A\\t%s\\n\" : \"%s needs update\\n\");\n \tunmerged_fmt = (in_porcelain ? \"U\\t%s\\n\" : \"%s: needs merge\\n\");\n \tfor (i = 0; i < istate->cache_nr; i++) {\n-\t\tstruct cache_entry *ce, *new;\n+\t\tstruct cache_entry *ce, *new_entry;\n \t\tint cache_errno = 0;\n \t\tint changed = 0;\n \t\tint filtered = 0;\n@@ -1408,10 +1408,10 @@ int refresh_index(struct index_state *istate, unsigned int flags,\n \t\tif (filtered)\n \t\t\tcontinue;\n \n-\t\tnew = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);\n-\t\tif (new == ce)\n+\t\tnew_entry = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);\n+\t\tif (new_entry == ce)\n \t\t\tcontinue;\n-\t\tif (!new) {\n+\t\tif (!new_entry) {\n \t\t\tconst char *fmt;\n \n \t\t\tif (really && cache_errno == EINVAL) {\n@@ -1440,7 +1440,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,\n \t\t\tcontinue;\n \t\t}\n \n-\t\treplace_index_entry(istate, i, new);\n+\t\treplace_index_entry(istate, i, new_entry);\n \t}\n \treturn has_errors;\n }\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339365","messageId":"20180214185959.221906-25-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 24/37] ref-filter: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:46Z","receivedAt":"2018-02-14T19:01:55Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n ref-filter.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 9dae6cfe3..99a45beb1 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -529,12 +529,12 @@ static void end_align_handler(struct ref_formatting_stack **stack)\n \n static void align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)\n {\n-\tstruct ref_formatting_stack *new;\n+\tstruct ref_formatting_stack *new_stack;\n \n \tpush_stack_element(&state->stack);\n-\tnew = state->stack;\n-\tnew->at_end = end_align_handler;\n-\tnew->at_end_data = &atomv->atom->u.align;\n+\tnew_stack = state->stack;\n+\tnew_stack->at_end = end_align_handler;\n+\tnew_stack->at_end_data = &atomv->atom->u.align;\n }\n \n static void if_then_else_handler(struct ref_formatting_stack **stack)\n@@ -574,16 +574,16 @@ static void if_then_else_handler(struct ref_formatting_stack **stack)\n \n static void if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)\n {\n-\tstruct ref_formatting_stack *new;\n+\tstruct ref_formatting_stack *new_stack;\n \tstruct if_then_else *if_then_else = xcalloc(sizeof(struct if_then_else), 1);\n \n \tif_then_else->str = atomv->atom->u.if_then_else.str;\n \tif_then_else->cmp_status = atomv->atom->u.if_then_else.cmp_status;\n \n \tpush_stack_element(&state->stack);\n-\tnew = state->stack;\n-\tnew->at_end = if_then_else_handler;\n-\tnew->at_end_data = if_then_else;\n+\tnew_stack = state->stack;\n+\tnew_stack->at_end = if_then_else_handler;\n+\tnew_stack->at_end_data = if_then_else;\n }\n \n static int is_empty(const char *s)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339367","messageId":"20180214185959.221906-27-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 26/37] split-index: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:48Z","receivedAt":"2018-02-14T19:02:01Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n split-index.c | 16 ++++++++--------\n split-index.h |  2 +-\n 2 files changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/split-index.c b/split-index.c\nindex 83e39ec8d..7be5f748a 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -303,17 +303,17 @@ void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce\n }\n \n void replace_index_entry_in_base(struct index_state *istate,\n-\t\t\t\t struct cache_entry *old,\n-\t\t\t\t struct cache_entry *new)\n+\t\t\t\t struct cache_entry *old_entry,\n+\t\t\t\t struct cache_entry *new_entry)\n {\n-\tif (old->index &&\n+\tif (old_entry->index &&\n \t    istate->split_index &&\n \t    istate->split_index->base &&\n-\t    old->index <= istate->split_index->base->cache_nr) {\n-\t\tnew->index = old->index;\n-\t\tif (old != istate->split_index->base->cache[new->index - 1])\n-\t\t\tfree(istate->split_index->base->cache[new->index - 1]);\n-\t\tistate->split_index->base->cache[new->index - 1] = new;\n+\t    old_entry->index <= istate->split_index->base->cache_nr) {\n+\t\tnew_entry->index = old_entry->index;\n+\t\tif (old_entry != istate->split_index->base->cache[new_entry->index - 1])\n+\t\t\tfree(istate->split_index->base->cache[new_entry->index - 1]);\n+\t\tistate->split_index->base->cache[new_entry->index - 1] = new_entry;\n \t}\n }\n \ndiff --git a/split-index.h b/split-index.h\nindex df91c1bda..43d66826e 100644\n--- a/split-index.h\n+++ b/split-index.h\n@@ -21,7 +21,7 @@ struct split_index *init_split_index(struct index_state *istate);\n void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce);\n void replace_index_entry_in_base(struct index_state *istate,\n \t\t\t\t struct cache_entry *old,\n-\t\t\t\t struct cache_entry *new);\n+\t\t\t\t struct cache_entry *new_entry);\n int read_link_extension(struct index_state *istate,\n \t\t\tconst void *data, unsigned long sz);\n int write_link_extension(struct strbuf *sb,\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339368","messageId":"20180214185959.221906-26-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 25/37] remote: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:47Z","receivedAt":"2018-02-14T19:02:02Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n remote.c | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex 4e93753e1..2922dca07 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1970,33 +1970,33 @@ static void unmark_and_free(struct commit_list *list, unsigned int mark)\n int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)\n {\n \tstruct object *o;\n-\tstruct commit *old, *new;\n+\tstruct commit *old_commit, *new_commit;\n \tstruct commit_list *list, *used;\n \tint found = 0;\n \n \t/*\n-\t * Both new and old must be commit-ish and new is descendant of\n-\t * old.  Otherwise we require --force.\n+\t * Both new_commit and old_commit must be commit-ish and new_commit is descendant of\n+\t * old_commit.  Otherwise we require --force.\n \t */\n \to = deref_tag(parse_object(old_oid), NULL, 0);\n \tif (!o || o->type != OBJ_COMMIT)\n \t\treturn 0;\n-\told = (struct commit *) o;\n+\told_commit = (struct commit *) o;\n \n \to = deref_tag(parse_object(new_oid), NULL, 0);\n \tif (!o || o->type != OBJ_COMMIT)\n \t\treturn 0;\n-\tnew = (struct commit *) o;\n+\tnew_commit = (struct commit *) o;\n \n-\tif (parse_commit(new) < 0)\n+\tif (parse_commit(new_commit) < 0)\n \t\treturn 0;\n \n \tused = list = NULL;\n-\tcommit_list_insert(new, &list);\n+\tcommit_list_insert(new_commit, &list);\n \twhile (list) {\n-\t\tnew = pop_most_recent_commit(&list, TMP_MARK);\n-\t\tcommit_list_insert(new, &used);\n-\t\tif (new == old) {\n+\t\tnew_commit = pop_most_recent_commit(&list, TMP_MARK);\n+\t\tcommit_list_insert(new_commit, &used);\n+\t\tif (new_commit == old_commit) {\n \t\t\tfound = 1;\n \t\t\tbreak;\n \t\t}\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339369","messageId":"20180214185959.221906-29-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 28/37] trailer: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:50Z","receivedAt":"2018-02-14T19:02:04Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n trailer.c | 34 +++++++++++++++++-----------------\n 1 file changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/trailer.c b/trailer.c\nindex 3ba157ed0..5a4a2ecf9 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -174,12 +174,12 @@ static void print_all(FILE *outfile, struct list_head *head,\n \n static struct trailer_item *trailer_from_arg(struct arg_item *arg_tok)\n {\n-\tstruct trailer_item *new = xcalloc(sizeof(*new), 1);\n-\tnew->token = arg_tok->token;\n-\tnew->value = arg_tok->value;\n+\tstruct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);\n+\tnew_item->token = arg_tok->token;\n+\tnew_item->value = arg_tok->value;\n \targ_tok->token = arg_tok->value = NULL;\n \tfree_arg_item(arg_tok);\n-\treturn new;\n+\treturn new_item;\n }\n \n static void add_arg_to_input_list(struct trailer_item *on_tok,\n@@ -666,30 +666,30 @@ static void parse_trailer(struct strbuf *tok, struct strbuf *val,\n static struct trailer_item *add_trailer_item(struct list_head *head, char *tok,\n \t\t\t\t\t     char *val)\n {\n-\tstruct trailer_item *new = xcalloc(sizeof(*new), 1);\n-\tnew->token = tok;\n-\tnew->value = val;\n-\tlist_add_tail(&new->list, head);\n-\treturn new;\n+\tstruct trailer_item *new_item = xcalloc(sizeof(*new_item), 1);\n+\tnew_item->token = tok;\n+\tnew_item->value = val;\n+\tlist_add_tail(&new_item->list, head);\n+\treturn new_item;\n }\n \n static void add_arg_item(struct list_head *arg_head, char *tok, char *val,\n \t\t\t const struct conf_info *conf,\n \t\t\t const struct new_trailer_item *new_trailer_item)\n {\n-\tstruct arg_item *new = xcalloc(sizeof(*new), 1);\n-\tnew->token = tok;\n-\tnew->value = val;\n-\tduplicate_conf(&new->conf, conf);\n+\tstruct arg_item *new_item = xcalloc(sizeof(*new_item), 1);\n+\tnew_item->token = tok;\n+\tnew_item->value = val;\n+\tduplicate_conf(&new_item->conf, conf);\n \tif (new_trailer_item) {\n \t\tif (new_trailer_item->where != WHERE_DEFAULT)\n-\t\t\tnew->conf.where = new_trailer_item->where;\n+\t\t\tnew_item->conf.where = new_trailer_item->where;\n \t\tif (new_trailer_item->if_exists != EXISTS_DEFAULT)\n-\t\t\tnew->conf.if_exists = new_trailer_item->if_exists;\n+\t\t\tnew_item->conf.if_exists = new_trailer_item->if_exists;\n \t\tif (new_trailer_item->if_missing != MISSING_DEFAULT)\n-\t\t\tnew->conf.if_missing = new_trailer_item->if_missing;\n+\t\t\tnew_item->conf.if_missing = new_trailer_item->if_missing;\n \t}\n-\tlist_add_tail(&new->list, arg_head);\n+\tlist_add_tail(&new_item->list, arg_head);\n }\n \n static void process_command_line_args(struct list_head *arg_head,\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339370","messageId":"20180214185959.221906-30-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 29/37] unpack-trees: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:51Z","receivedAt":"2018-02-14T19:02:07Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n unpack-trees.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 96c3327f1..bdedabcd5 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -194,10 +194,10 @@ static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,\n static struct cache_entry *dup_entry(const struct cache_entry *ce)\n {\n \tunsigned int size = ce_size(ce);\n-\tstruct cache_entry *new = xmalloc(size);\n+\tstruct cache_entry *new_entry = xmalloc(size);\n \n-\tmemcpy(new, ce, size);\n-\treturn new;\n+\tmemcpy(new_entry, ce, size);\n+\treturn new_entry;\n }\n \n static void add_entry(struct unpack_trees_options *o,\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339371","messageId":"20180214185959.221906-28-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 27/37] submodule: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:49Z","receivedAt":"2018-02-14T19:02:15Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n submodule.c | 30 +++++++++++++++---------------\n submodule.h |  2 +-\n 2 files changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/submodule.c b/submodule.c\nindex cd18400e8..12a2503fd 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -590,7 +590,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,\n \t\tstruct object_id *one, struct object_id *two,\n \t\tunsigned dirty_submodule)\n {\n-\tconst struct object_id *old = the_hash_algo->empty_tree, *new = the_hash_algo->empty_tree;\n+\tconst struct object_id *old_oid = the_hash_algo->empty_tree, *new_oid = the_hash_algo->empty_tree;\n \tstruct commit *left = NULL, *right = NULL;\n \tstruct commit_list *merge_bases = NULL;\n \tstruct child_process cp = CHILD_PROCESS_INIT;\n@@ -605,9 +605,9 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,\n \t\tgoto done;\n \n \tif (left)\n-\t\told = one;\n+\t\told_oid = one;\n \tif (right)\n-\t\tnew = two;\n+\t\tnew_oid = two;\n \n \tcp.git_cmd = 1;\n \tcp.dir = path;\n@@ -630,7 +630,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,\n \t\targv_array_pushf(&cp.args, \"--dst-prefix=%s%s/\",\n \t\t\t\t o->b_prefix, path);\n \t}\n-\targv_array_push(&cp.args, oid_to_hex(old));\n+\targv_array_push(&cp.args, oid_to_hex(old_oid));\n \t/*\n \t * If the submodule has modified content, we will diff against the\n \t * work tree, under the assumption that the user has asked for the\n@@ -638,7 +638,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,\n \t * haven't yet been committed to the submodule yet.\n \t */\n \tif (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))\n-\t\targv_array_push(&cp.args, oid_to_hex(new));\n+\t\targv_array_push(&cp.args, oid_to_hex(new_oid));\n \n \tprepare_submodule_repo_env(&cp.env_array);\n \tif (start_command(&cp))\n@@ -1578,8 +1578,8 @@ static void submodule_reset_index(const char *path)\n  * pass NULL for old or new respectively.\n  */\n int submodule_move_head(const char *path,\n-\t\t\t const char *old,\n-\t\t\t const char *new,\n+\t\t\t const char *old_head,\n+\t\t\t const char *new_head,\n \t\t\t unsigned flags)\n {\n \tint ret = 0;\n@@ -1600,7 +1600,7 @@ int submodule_move_head(const char *path,\n \telse\n \t\terror_code_ptr = NULL;\n \n-\tif (old && !is_submodule_populated_gently(path, error_code_ptr))\n+\tif (old_head && !is_submodule_populated_gently(path, error_code_ptr))\n \t\treturn 0;\n \n \tsub = submodule_from_path(&null_oid, path);\n@@ -1608,14 +1608,14 @@ int submodule_move_head(const char *path,\n \tif (!sub)\n \t\tdie(\"BUG: could not get submodule information for '%s'\", path);\n \n-\tif (old && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) {\n+\tif (old_head && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) {\n \t\t/* Check if the submodule has a dirty index. */\n \t\tif (submodule_has_dirty_index(sub))\n \t\t\treturn error(_(\"submodule '%s' has dirty index\"), path);\n \t}\n \n \tif (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {\n-\t\tif (old) {\n+\t\tif (old_head) {\n \t\t\tif (!submodule_uses_gitfile(path))\n \t\t\t\tabsorb_git_dir_into_superproject(\"\", path,\n \t\t\t\t\tABSORB_GITDIR_RECURSE_SUBMODULES);\n@@ -1629,7 +1629,7 @@ int submodule_move_head(const char *path,\n \t\t\tsubmodule_reset_index(path);\n \t\t}\n \n-\t\tif (old && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {\n+\t\tif (old_head && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {\n \t\t\tchar *gitdir = xstrfmt(\"%s/modules/%s\",\n \t\t\t\t    get_git_common_dir(), sub->name);\n \t\t\tconnect_work_tree_and_git_dir(path, gitdir);\n@@ -1658,9 +1658,9 @@ int submodule_move_head(const char *path,\n \t\targv_array_push(&cp.args, \"-m\");\n \n \tif (!(flags & SUBMODULE_MOVE_HEAD_FORCE))\n-\t\targv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);\n+\t\targv_array_push(&cp.args, old_head ? old_head : EMPTY_TREE_SHA1_HEX);\n \n-\targv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);\n+\targv_array_push(&cp.args, new_head ? new_head : EMPTY_TREE_SHA1_HEX);\n \n \tif (run_command(&cp)) {\n \t\tret = -1;\n@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,\n \t}\n \n \tif (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {\n-\t\tif (new) {\n+\t\tif (new_head) {\n \t\t\tchild_process_init(&cp);\n \t\t\t/* also set the HEAD accordingly */\n \t\t\tcp.git_cmd = 1;\n@@ -1677,7 +1677,7 @@ int submodule_move_head(const char *path,\n \n \t\t\tprepare_submodule_repo_env(&cp.env_array);\n \t\t\targv_array_pushl(&cp.args, \"update-ref\", \"HEAD\",\n-\t\t\t\t\t \"--no-deref\", new, NULL);\n+\t\t\t\t\t \"--no-deref\", new_head, NULL);\n \n \t\t\tif (run_command(&cp)) {\n \t\t\t\tret = -1;\ndiff --git a/submodule.h b/submodule.h\nindex b9b7ef003..9589f1312 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -117,7 +117,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule);\n #define SUBMODULE_MOVE_HEAD_FORCE   (1<<1)\n extern int submodule_move_head(const char *path,\n \t\t\t       const char *old,\n-\t\t\t       const char *new,\n+\t\t\t       const char *new_head,\n \t\t\t       unsigned flags);\n \n /*\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339372","messageId":"20180214185959.221906-31-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 30/37] init-db: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:52Z","receivedAt":"2018-02-14T19:02:17Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/init-db.c | 30 +++++++++++++++---------------\n 1 file changed, 15 insertions(+), 15 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex c9b7946ba..68ff4ad75 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -24,11 +24,11 @@ static int init_is_bare_repository = 0;\n static int init_shared_repository = -1;\n static const char *init_db_template_dir;\n \n-static void copy_templates_1(struct strbuf *path, struct strbuf *template,\n+static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,\n \t\t\t     DIR *dir)\n {\n \tsize_t path_baselen = path->len;\n-\tsize_t template_baselen = template->len;\n+\tsize_t template_baselen = template_path->len;\n \tstruct dirent *de;\n \n \t/* Note: if \".git/hooks\" file exists in the repository being\n@@ -44,12 +44,12 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,\n \t\tint exists = 0;\n \n \t\tstrbuf_setlen(path, path_baselen);\n-\t\tstrbuf_setlen(template, template_baselen);\n+\t\tstrbuf_setlen(template_path, template_baselen);\n \n \t\tif (de->d_name[0] == '.')\n \t\t\tcontinue;\n \t\tstrbuf_addstr(path, de->d_name);\n-\t\tstrbuf_addstr(template, de->d_name);\n+\t\tstrbuf_addstr(template_path, de->d_name);\n \t\tif (lstat(path->buf, &st_git)) {\n \t\t\tif (errno != ENOENT)\n \t\t\t\tdie_errno(_(\"cannot stat '%s'\"), path->buf);\n@@ -57,36 +57,36 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,\n \t\telse\n \t\t\texists = 1;\n \n-\t\tif (lstat(template->buf, &st_template))\n-\t\t\tdie_errno(_(\"cannot stat template '%s'\"), template->buf);\n+\t\tif (lstat(template_path->buf, &st_template))\n+\t\t\tdie_errno(_(\"cannot stat template '%s'\"), template_path->buf);\n \n \t\tif (S_ISDIR(st_template.st_mode)) {\n-\t\t\tDIR *subdir = opendir(template->buf);\n+\t\t\tDIR *subdir = opendir(template_path->buf);\n \t\t\tif (!subdir)\n-\t\t\t\tdie_errno(_(\"cannot opendir '%s'\"), template->buf);\n+\t\t\t\tdie_errno(_(\"cannot opendir '%s'\"), template_path->buf);\n \t\t\tstrbuf_addch(path, '/');\n-\t\t\tstrbuf_addch(template, '/');\n-\t\t\tcopy_templates_1(path, template, subdir);\n+\t\t\tstrbuf_addch(template_path, '/');\n+\t\t\tcopy_templates_1(path, template_path, subdir);\n \t\t\tclosedir(subdir);\n \t\t}\n \t\telse if (exists)\n \t\t\tcontinue;\n \t\telse if (S_ISLNK(st_template.st_mode)) {\n \t\t\tstruct strbuf lnk = STRBUF_INIT;\n-\t\t\tif (strbuf_readlink(&lnk, template->buf, 0) < 0)\n-\t\t\t\tdie_errno(_(\"cannot readlink '%s'\"), template->buf);\n+\t\t\tif (strbuf_readlink(&lnk, template_path->buf, 0) < 0)\n+\t\t\t\tdie_errno(_(\"cannot readlink '%s'\"), template_path->buf);\n \t\t\tif (symlink(lnk.buf, path->buf))\n \t\t\t\tdie_errno(_(\"cannot symlink '%s' '%s'\"),\n \t\t\t\t\t  lnk.buf, path->buf);\n \t\t\tstrbuf_release(&lnk);\n \t\t}\n \t\telse if (S_ISREG(st_template.st_mode)) {\n-\t\t\tif (copy_file(path->buf, template->buf, st_template.st_mode))\n+\t\t\tif (copy_file(path->buf, template_path->buf, st_template.st_mode))\n \t\t\t\tdie_errno(_(\"cannot copy '%s' to '%s'\"),\n-\t\t\t\t\t  template->buf, path->buf);\n+\t\t\t\t\t  template_path->buf, path->buf);\n \t\t}\n \t\telse\n-\t\t\terror(_(\"ignoring template %s\"), template->buf);\n+\t\t\terror(_(\"ignoring template %s\"), template_path->buf);\n \t}\n }\n \n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339373","messageId":"20180214185959.221906-34-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 33/37] environment: rename 'namespace' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:55Z","receivedAt":"2018-02-14T19:02:18Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n environment.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/environment.c b/environment.c\nindex 98f77ea95..270ba98b5 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -98,7 +98,7 @@ int ignore_untracked_cache_config;\n /* This is set by setup_git_dir_gently() and/or git_default_config() */\n char *git_work_tree_cfg;\n \n-static char *namespace;\n+static char *git_namespace;\n \n static const char *super_prefix;\n \n@@ -156,8 +156,8 @@ void setup_git_env(void)\n \tfree(git_replace_ref_base);\n \tgit_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base\n \t\t\t\t\t\t\t  : \"refs/replace/\");\n-\tfree(namespace);\n-\tnamespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));\n+\tfree(git_namespace);\n+\tgit_namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));\n \tshallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);\n \tif (shallow_file)\n \t\tset_alternate_shallow_file(shallow_file, 0);\n@@ -191,9 +191,9 @@ const char *get_git_common_dir(void)\n \n const char *get_git_namespace(void)\n {\n-\tif (!namespace)\n+\tif (!git_namespace)\n \t\tBUG(\"git environment hasn't been setup\");\n-\treturn namespace;\n+\treturn git_namespace;\n }\n \n const char *strip_namespace(const char *namespaced_ref)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339374","messageId":"20180214185959.221906-35-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 34/37] wrapper: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:56Z","receivedAt":"2018-02-14T19:02:21Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n git-compat-util.h |  4 ++--\n wrapper.c         | 40 ++++++++++++++++++++--------------------\n 2 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 68b2ad531..07e383257 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -826,8 +826,8 @@ extern ssize_t xpread(int fd, void *buf, size_t len, off_t offset);\n extern int xdup(int fd);\n extern FILE *xfopen(const char *path, const char *mode);\n extern FILE *xfdopen(int fd, const char *mode);\n-extern int xmkstemp(char *template);\n-extern int xmkstemp_mode(char *template, int mode);\n+extern int xmkstemp(char *temp_filename);\n+extern int xmkstemp_mode(char *temp_filename, int mode);\n extern char *xgetcwd(void);\n extern FILE *fopen_for_writing(const char *path);\n extern FILE *fopen_or_warn(const char *path, const char *mode);\ndiff --git a/wrapper.c b/wrapper.c\nindex d20356a77..1fd5e33ea 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -445,21 +445,21 @@ FILE *fopen_or_warn(const char *path, const char *mode)\n \treturn NULL;\n }\n \n-int xmkstemp(char *template)\n+int xmkstemp(char *filename_template)\n {\n \tint fd;\n \tchar origtemplate[PATH_MAX];\n-\tstrlcpy(origtemplate, template, sizeof(origtemplate));\n+\tstrlcpy(origtemplate, filename_template, sizeof(origtemplate));\n \n-\tfd = mkstemp(template);\n+\tfd = mkstemp(filename_template);\n \tif (fd < 0) {\n \t\tint saved_errno = errno;\n \t\tconst char *nonrelative_template;\n \n-\t\tif (strlen(template) != strlen(origtemplate))\n-\t\t\ttemplate = origtemplate;\n+\t\tif (strlen(filename_template) != strlen(origtemplate))\n+\t\t\tfilename_template = origtemplate;\n \n-\t\tnonrelative_template = absolute_path(template);\n+\t\tnonrelative_template = absolute_path(filename_template);\n \t\terrno = saved_errno;\n \t\tdie_errno(\"Unable to create temporary file '%s'\",\n \t\t\tnonrelative_template);\n@@ -481,7 +481,7 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)\n \tstatic const int num_letters = 62;\n \tuint64_t value;\n \tstruct timeval tv;\n-\tchar *template;\n+\tchar *filename_template;\n \tsize_t len;\n \tint fd, count;\n \n@@ -503,16 +503,16 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)\n \t */\n \tgettimeofday(&tv, NULL);\n \tvalue = ((size_t)(tv.tv_usec << 16)) ^ tv.tv_sec ^ getpid();\n-\ttemplate = &pattern[len - 6 - suffix_len];\n+\tfilename_template = &pattern[len - 6 - suffix_len];\n \tfor (count = 0; count < TMP_MAX; ++count) {\n \t\tuint64_t v = value;\n \t\t/* Fill in the random bits. */\n-\t\ttemplate[0] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[1] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[2] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[3] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[4] = letters[v % num_letters]; v /= num_letters;\n-\t\ttemplate[5] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[0] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[1] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[2] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[3] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[4] = letters[v % num_letters]; v /= num_letters;\n+\t\tfilename_template[5] = letters[v % num_letters]; v /= num_letters;\n \n \t\tfd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);\n \t\tif (fd >= 0)\n@@ -541,21 +541,21 @@ int git_mkstemp_mode(char *pattern, int mode)\n \treturn git_mkstemps_mode(pattern, 0, mode);\n }\n \n-int xmkstemp_mode(char *template, int mode)\n+int xmkstemp_mode(char *filename_template, int mode)\n {\n \tint fd;\n \tchar origtemplate[PATH_MAX];\n-\tstrlcpy(origtemplate, template, sizeof(origtemplate));\n+\tstrlcpy(origtemplate, filename_template, sizeof(origtemplate));\n \n-\tfd = git_mkstemp_mode(template, mode);\n+\tfd = git_mkstemp_mode(filename_template, mode);\n \tif (fd < 0) {\n \t\tint saved_errno = errno;\n \t\tconst char *nonrelative_template;\n \n-\t\tif (!template[0])\n-\t\t\ttemplate = origtemplate;\n+\t\tif (!filename_template[0])\n+\t\t\tfilename_template = origtemplate;\n \n-\t\tnonrelative_template = absolute_path(template);\n+\t\tnonrelative_template = absolute_path(filename_template);\n \t\terrno = saved_errno;\n \t\tdie_errno(\"Unable to create temporary file '%s'\",\n \t\t\tnonrelative_template);\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339375","messageId":"20180214185959.221906-36-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 35/37] tempfile: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:57Z","receivedAt":"2018-02-14T19:02:25Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n tempfile.c | 12 ++++++------\n tempfile.h | 34 +++++++++++++++++-----------------\n 2 files changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/tempfile.c b/tempfile.c\nindex 5fdafdd2d..139ecd97f 100644\n--- a/tempfile.c\n+++ b/tempfile.c\n@@ -165,11 +165,11 @@ struct tempfile *register_tempfile(const char *path)\n \treturn tempfile;\n }\n \n-struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)\n+struct tempfile *mks_tempfile_sm(const char *filename_template, int suffixlen, int mode)\n {\n \tstruct tempfile *tempfile = new_tempfile();\n \n-\tstrbuf_add_absolute_path(&tempfile->filename, template);\n+\tstrbuf_add_absolute_path(&tempfile->filename, filename_template);\n \ttempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);\n \tif (tempfile->fd < 0) {\n \t\tdeactivate_tempfile(tempfile);\n@@ -179,7 +179,7 @@ struct tempfile *mks_tempfile_sm(const char *template, int suffixlen, int mode)\n \treturn tempfile;\n }\n \n-struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)\n+struct tempfile *mks_tempfile_tsm(const char *filename_template, int suffixlen, int mode)\n {\n \tstruct tempfile *tempfile = new_tempfile();\n \tconst char *tmpdir;\n@@ -188,7 +188,7 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)\n \tif (!tmpdir)\n \t\ttmpdir = \"/tmp\";\n \n-\tstrbuf_addf(&tempfile->filename, \"%s/%s\", tmpdir, template);\n+\tstrbuf_addf(&tempfile->filename, \"%s/%s\", tmpdir, filename_template);\n \ttempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode);\n \tif (tempfile->fd < 0) {\n \t\tdeactivate_tempfile(tempfile);\n@@ -198,12 +198,12 @@ struct tempfile *mks_tempfile_tsm(const char *template, int suffixlen, int mode)\n \treturn tempfile;\n }\n \n-struct tempfile *xmks_tempfile_m(const char *template, int mode)\n+struct tempfile *xmks_tempfile_m(const char *filename_template, int mode)\n {\n \tstruct tempfile *tempfile;\n \tstruct strbuf full_template = STRBUF_INIT;\n \n-\tstrbuf_add_absolute_path(&full_template, template);\n+\tstrbuf_add_absolute_path(&full_template, filename_template);\n \ttempfile = mks_tempfile_m(full_template.buf, mode);\n \tif (!tempfile)\n \t\tdie_errno(\"Unable to create temporary file '%s'\",\ndiff --git a/tempfile.h b/tempfile.h\nindex 450908b2e..8959c5f1b 100644\n--- a/tempfile.h\n+++ b/tempfile.h\n@@ -135,58 +135,58 @@ extern struct tempfile *register_tempfile(const char *path);\n  */\n \n /* See \"mks_tempfile functions\" above. */\n-extern struct tempfile *mks_tempfile_sm(const char *template,\n+extern struct tempfile *mks_tempfile_sm(const char *filename_template,\n \t\t\t\t\tint suffixlen, int mode);\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_s(const char *template,\n+static inline struct tempfile *mks_tempfile_s(const char *filename_template,\n \t\t\t\t\t      int suffixlen)\n {\n-\treturn mks_tempfile_sm(template, suffixlen, 0600);\n+\treturn mks_tempfile_sm(filename_template, suffixlen, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_m(const char *template, int mode)\n+static inline struct tempfile *mks_tempfile_m(const char *filename_template, int mode)\n {\n-\treturn mks_tempfile_sm(template, 0, mode);\n+\treturn mks_tempfile_sm(filename_template, 0, mode);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile(const char *template)\n+static inline struct tempfile *mks_tempfile(const char *filename_template)\n {\n-\treturn mks_tempfile_sm(template, 0, 0600);\n+\treturn mks_tempfile_sm(filename_template, 0, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-extern struct tempfile *mks_tempfile_tsm(const char *template,\n+extern struct tempfile *mks_tempfile_tsm(const char *filename_template,\n \t\t\t\t\t int suffixlen, int mode);\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_ts(const char *template,\n+static inline struct tempfile *mks_tempfile_ts(const char *filename_template,\n \t\t\t\t\t       int suffixlen)\n {\n-\treturn mks_tempfile_tsm(template, suffixlen, 0600);\n+\treturn mks_tempfile_tsm(filename_template, suffixlen, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_tm(const char *template, int mode)\n+static inline struct tempfile *mks_tempfile_tm(const char *filename_template, int mode)\n {\n-\treturn mks_tempfile_tsm(template, 0, mode);\n+\treturn mks_tempfile_tsm(filename_template, 0, mode);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *mks_tempfile_t(const char *template)\n+static inline struct tempfile *mks_tempfile_t(const char *filename_template)\n {\n-\treturn mks_tempfile_tsm(template, 0, 0600);\n+\treturn mks_tempfile_tsm(filename_template, 0, 0600);\n }\n \n /* See \"mks_tempfile functions\" above. */\n-extern struct tempfile *xmks_tempfile_m(const char *template, int mode);\n+extern struct tempfile *xmks_tempfile_m(const char *filename_template, int mode);\n \n /* See \"mks_tempfile functions\" above. */\n-static inline struct tempfile *xmks_tempfile(const char *template)\n+static inline struct tempfile *xmks_tempfile(const char *filename_template)\n {\n-\treturn xmks_tempfile_m(template, 0600);\n+\treturn xmks_tempfile_m(filename_template, 0600);\n }\n \n /*\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339376","messageId":"20180214185959.221906-37-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 36/37] trailer: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:58Z","receivedAt":"2018-02-14T19:02:30Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n trailer.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/trailer.c b/trailer.c\nindex 5a4a2ecf9..c508c9b75 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1000,7 +1000,7 @@ static struct tempfile *trailers_tempfile;\n static FILE *create_in_place_tempfile(const char *file)\n {\n \tstruct stat st;\n-\tstruct strbuf template = STRBUF_INIT;\n+\tstruct strbuf filename_template = STRBUF_INIT;\n \tconst char *tail;\n \tFILE *outfile;\n \n@@ -1014,11 +1014,11 @@ static FILE *create_in_place_tempfile(const char *file)\n \t/* Create temporary file in the same directory as the original */\n \ttail = strrchr(file, '/');\n \tif (tail != NULL)\n-\t\tstrbuf_add(&template, file, tail - file + 1);\n-\tstrbuf_addstr(&template, \"git-interpret-trailers-XXXXXX\");\n+\t\tstrbuf_add(&filename_template, file, tail - file + 1);\n+\tstrbuf_addstr(&filename_template, \"git-interpret-trailers-XXXXXX\");\n \n-\ttrailers_tempfile = xmks_tempfile_m(template.buf, st.st_mode);\n-\tstrbuf_release(&template);\n+\ttrailers_tempfile = xmks_tempfile_m(filename_template.buf, st.st_mode);\n+\tstrbuf_release(&filename_template);\n \toutfile = fdopen_tempfile(trailers_tempfile, \"w\");\n \tif (!outfile)\n \t\tdie_errno(_(\"could not open temporary file\"));\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339377","messageId":"20180214185959.221906-38-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 37/37] replace: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:59Z","receivedAt":"2018-02-14T19:02:32Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/replace.c | 34 +++++++++++++++++-----------------\n 1 file changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 42cf4f62a..303ca134d 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -284,30 +284,30 @@ static int edit_and_replace(const char *object_ref, int force, int raw)\n {\n \tchar *tmpfile = git_pathdup(\"REPLACE_EDITOBJ\");\n \tenum object_type type;\n-\tstruct object_id old, new, prev;\n+\tstruct object_id old_oid, new_oid, prev;\n \tstruct strbuf ref = STRBUF_INIT;\n \n-\tif (get_oid(object_ref, &old) < 0)\n+\tif (get_oid(object_ref, &old_oid) < 0)\n \t\tdie(\"Not a valid object name: '%s'\", object_ref);\n \n-\ttype = sha1_object_info(old.hash, NULL);\n+\ttype = sha1_object_info(old_oid.hash, NULL);\n \tif (type < 0)\n-\t\tdie(\"unable to get object type for %s\", oid_to_hex(&old));\n+\t\tdie(\"unable to get object type for %s\", oid_to_hex(&old_oid));\n \n-\tcheck_ref_valid(&old, &prev, &ref, force);\n+\tcheck_ref_valid(&old_oid, &prev, &ref, force);\n \tstrbuf_release(&ref);\n \n-\texport_object(&old, type, raw, tmpfile);\n+\texport_object(&old_oid, type, raw, tmpfile);\n \tif (launch_editor(tmpfile, NULL, NULL) < 0)\n \t\tdie(\"editing object file failed\");\n-\timport_object(&new, type, raw, tmpfile);\n+\timport_object(&new_oid, type, raw, tmpfile);\n \n \tfree(tmpfile);\n \n-\tif (!oidcmp(&old, &new))\n-\t\treturn error(\"new object is the same as the old one: '%s'\", oid_to_hex(&old));\n+\tif (!oidcmp(&old_oid, &new_oid))\n+\t\treturn error(\"new object is the same as the old one: '%s'\", oid_to_hex(&old_oid));\n \n-\treturn replace_object_oid(object_ref, &old, \"replacement\", &new, force);\n+\treturn replace_object_oid(object_ref, &old_oid, \"replacement\", &new_oid, force);\n }\n \n static void replace_parents(struct strbuf *buf, int argc, const char **argv)\n@@ -386,16 +386,16 @@ static void check_mergetags(struct commit *commit, int argc, const char **argv)\n \n static int create_graft(int argc, const char **argv, int force)\n {\n-\tstruct object_id old, new;\n+\tstruct object_id old_oid, new_oid;\n \tconst char *old_ref = argv[0];\n \tstruct commit *commit;\n \tstruct strbuf buf = STRBUF_INIT;\n \tconst char *buffer;\n \tunsigned long size;\n \n-\tif (get_oid(old_ref, &old) < 0)\n+\tif (get_oid(old_ref, &old_oid) < 0)\n \t\tdie(_(\"Not a valid object name: '%s'\"), old_ref);\n-\tcommit = lookup_commit_or_die(&old, old_ref);\n+\tcommit = lookup_commit_or_die(&old_oid, old_ref);\n \n \tbuffer = get_commit_buffer(commit, &size);\n \tstrbuf_add(&buf, buffer, size);\n@@ -410,15 +410,15 @@ static int create_graft(int argc, const char **argv, int force)\n \n \tcheck_mergetags(commit, argc, argv);\n \n-\tif (write_sha1_file(buf.buf, buf.len, commit_type, new.hash))\n+\tif (write_sha1_file(buf.buf, buf.len, commit_type, new_oid.hash))\n \t\tdie(_(\"could not write replacement commit for: '%s'\"), old_ref);\n \n \tstrbuf_release(&buf);\n \n-\tif (!oidcmp(&old, &new))\n-\t\treturn error(\"new commit is the same as the old one: '%s'\", oid_to_hex(&old));\n+\tif (!oidcmp(&old_oid, &new_oid))\n+\t\treturn error(\"new commit is the same as the old one: '%s'\", oid_to_hex(&old_oid));\n \n-\treturn replace_object_oid(old_ref, &old, \"replacement\", &new, force);\n+\treturn replace_object_oid(old_ref, &old_oid, \"replacement\", &new_oid, force);\n }\n \n int cmd_replace(int argc, const char **argv, const char *prefix)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339378","messageId":"20180214185959.221906-32-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 31/37] environment: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:53Z","receivedAt":"2018-02-14T19:02:34Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n cache.h       |  2 +-\n environment.c | 14 +++++++-------\n 2 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 69b5a3bf8..5b8d49377 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1673,7 +1673,7 @@ struct pack_entry {\n  * usual \"XXXXXX\" trailer, and the resulting filename is written into the\n  * \"template\" buffer. Returns the open descriptor.\n  */\n-extern int odb_mkstemp(struct strbuf *template, const char *pattern);\n+extern int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);\n \n /*\n  * Create a pack .keep file named \"name\" (which should generally be the output\ndiff --git a/environment.c b/environment.c\nindex 63ac38a46..98f77ea95 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -247,7 +247,7 @@ char *get_object_directory(void)\n \treturn the_repository->objectdir;\n }\n \n-int odb_mkstemp(struct strbuf *template, const char *pattern)\n+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)\n {\n \tint fd;\n \t/*\n@@ -255,16 +255,16 @@ int odb_mkstemp(struct strbuf *template, const char *pattern)\n \t * restrictive except to remove write permission.\n \t */\n \tint mode = 0444;\n-\tgit_path_buf(template, \"objects/%s\", pattern);\n-\tfd = git_mkstemp_mode(template->buf, mode);\n+\tgit_path_buf(temp_filename, \"objects/%s\", pattern);\n+\tfd = git_mkstemp_mode(temp_filename->buf, mode);\n \tif (0 <= fd)\n \t\treturn fd;\n \n \t/* slow path */\n-\t/* some mkstemp implementations erase template on failure */\n-\tgit_path_buf(template, \"objects/%s\", pattern);\n-\tsafe_create_leading_directories(template->buf);\n-\treturn xmkstemp_mode(template->buf, mode);\n+\t/* some mkstemp implementations erase temp_filename on failure */\n+\tgit_path_buf(temp_filename, \"objects/%s\", pattern);\n+\tsafe_create_leading_directories(temp_filename->buf);\n+\treturn xmkstemp_mode(temp_filename->buf, mode);\n }\n \n int odb_pack_keep(const char *name)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339379","messageId":"20180214185959.221906-33-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 32/37] diff: rename 'template' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:54Z","receivedAt":"2018-02-14T19:02:38Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 2de9c5ed2..5e46502cd 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3660,15 +3660,15 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,\n \t\t\t   int mode)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n-\tstruct strbuf template = STRBUF_INIT;\n+\tstruct strbuf tempfile = STRBUF_INIT;\n \tchar *path_dup = xstrdup(path);\n \tconst char *base = basename(path_dup);\n \n \t/* Generate \"XXXXXX_basename.ext\" */\n-\tstrbuf_addstr(&template, \"XXXXXX_\");\n-\tstrbuf_addstr(&template, base);\n+\tstrbuf_addstr(&tempfile, \"XXXXXX_\");\n+\tstrbuf_addstr(&tempfile, base);\n \n-\ttemp->tempfile = mks_tempfile_ts(template.buf, strlen(base) + 1);\n+\ttemp->tempfile = mks_tempfile_ts(tempfile.buf, strlen(base) + 1);\n \tif (!temp->tempfile)\n \t\tdie_errno(\"unable to create temp-file\");\n \tif (convert_to_working_tree(path,\n@@ -3683,7 +3683,7 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,\n \toid_to_hex_r(temp->hex, oid);\n \txsnprintf(temp->mode, sizeof(temp->mode), \"%06o\", mode);\n \tstrbuf_release(&buf);\n-\tstrbuf_release(&template);\n+\tstrbuf_release(&tempfile);\n \tfree(path_dup);\n }\n \n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339380","messageId":"20180214185959.221906-18-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 17/37] diff: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:39Z","receivedAt":"2018-02-14T19:02:42Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n diff.c | 44 ++++++++++++++++++++++----------------------\n 1 file changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex d682d0d1f..2de9c5ed2 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1504,7 +1504,7 @@ struct diff_words_style_elem {\n \n struct diff_words_style {\n \tenum diff_words_type type;\n-\tstruct diff_words_style_elem new, old, ctx;\n+\tstruct diff_words_style_elem new_word, old_word, ctx;\n \tconst char *newline;\n };\n \n@@ -1655,12 +1655,12 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)\n \t}\n \tif (minus_begin != minus_end) {\n \t\tfn_out_diff_words_write_helper(diff_words->opt,\n-\t\t\t\t&style->old, style->newline,\n+\t\t\t\t&style->old_word, style->newline,\n \t\t\t\tminus_end - minus_begin, minus_begin);\n \t}\n \tif (plus_begin != plus_end) {\n \t\tfn_out_diff_words_write_helper(diff_words->opt,\n-\t\t\t\t&style->new, style->newline,\n+\t\t\t\t&style->new_word, style->newline,\n \t\t\t\tplus_end - plus_begin, plus_begin);\n \t}\n \n@@ -1758,7 +1758,7 @@ static void diff_words_show(struct diff_words_data *diff_words)\n \t\temit_diff_symbol(diff_words->opt, DIFF_SYMBOL_WORD_DIFF,\n \t\t\t\t line_prefix, strlen(line_prefix), 0);\n \t\tfn_out_diff_words_write_helper(diff_words->opt,\n-\t\t\t&style->old, style->newline,\n+\t\t\t&style->old_word, style->newline,\n \t\t\tdiff_words->minus.text.size,\n \t\t\tdiff_words->minus.text.ptr);\n \t\tdiff_words->minus.text.size = 0;\n@@ -1883,8 +1883,8 @@ static void init_diff_words_data(struct emit_callback *ecbdata,\n \t}\n \tif (want_color(o->use_color)) {\n \t\tstruct diff_words_style *st = ecbdata->diff_words->style;\n-\t\tst->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);\n-\t\tst->new.color = diff_get_color_opt(o, DIFF_FILE_NEW);\n+\t\tst->old_word.color = diff_get_color_opt(o, DIFF_FILE_OLD);\n+\t\tst->new_word.color = diff_get_color_opt(o, DIFF_FILE_NEW);\n \t\tst->ctx.color = diff_get_color_opt(o, DIFF_CONTEXT);\n \t}\n }\n@@ -2047,8 +2047,8 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)\n \n static char *pprint_rename(const char *a, const char *b)\n {\n-\tconst char *old = a;\n-\tconst char *new = b;\n+\tconst char *old_name = a;\n+\tconst char *new_name = b;\n \tstruct strbuf name = STRBUF_INIT;\n \tint pfx_length, sfx_length;\n \tint pfx_adjust_for_slash;\n@@ -2067,16 +2067,16 @@ static char *pprint_rename(const char *a, const char *b)\n \n \t/* Find common prefix */\n \tpfx_length = 0;\n-\twhile (*old && *new && *old == *new) {\n-\t\tif (*old == '/')\n-\t\t\tpfx_length = old - a + 1;\n-\t\told++;\n-\t\tnew++;\n+\twhile (*old_name && *new_name && *old_name == *new_name) {\n+\t\tif (*old_name == '/')\n+\t\t\tpfx_length = old_name - a + 1;\n+\t\told_name++;\n+\t\tnew_name++;\n \t}\n \n \t/* Find common suffix */\n-\told = a + len_a;\n-\tnew = b + len_b;\n+\told_name = a + len_a;\n+\tnew_name = b + len_b;\n \tsfx_length = 0;\n \t/*\n \t * If there is a common prefix, it must end in a slash.  In\n@@ -2087,13 +2087,13 @@ static char *pprint_rename(const char *a, const char *b)\n \t * underrun the input strings.\n \t */\n \tpfx_adjust_for_slash = (pfx_length ? 1 : 0);\n-\twhile (a + pfx_length - pfx_adjust_for_slash <= old &&\n-\t       b + pfx_length - pfx_adjust_for_slash <= new &&\n-\t       *old == *new) {\n-\t\tif (*old == '/')\n-\t\t\tsfx_length = len_a - (old - a);\n-\t\told--;\n-\t\tnew--;\n+\twhile (a + pfx_length - pfx_adjust_for_slash <= old_name &&\n+\t       b + pfx_length - pfx_adjust_for_slash <= new_name &&\n+\t       *old_name == *new_name) {\n+\t\tif (*old_name == '/')\n+\t\t\tsfx_length = len_a - (old_name - a);\n+\t\told_name--;\n+\t\tnew_name--;\n \t}\n \n \t/*\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339381","messageId":"20180214185959.221906-8-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 07/37] apply: rename 'try' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:29Z","receivedAt":"2018-02-14T19:02:50Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n apply.c | 68 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 34 insertions(+), 34 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 321a9fa68..071f653c6 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -2386,8 +2386,8 @@ static void update_pre_post_images(struct image *preimage,\n static int line_by_line_fuzzy_match(struct image *img,\n \t\t\t\t    struct image *preimage,\n \t\t\t\t    struct image *postimage,\n-\t\t\t\t    unsigned long try,\n-\t\t\t\t    int try_lno,\n+\t\t\t\t    unsigned long current,\n+\t\t\t\t    int current_lno,\n \t\t\t\t    int preimage_limit)\n {\n \tint i;\n@@ -2404,9 +2404,9 @@ static int line_by_line_fuzzy_match(struct image *img,\n \n \tfor (i = 0; i < preimage_limit; i++) {\n \t\tsize_t prelen = preimage->line[i].len;\n-\t\tsize_t imglen = img->line[try_lno+i].len;\n+\t\tsize_t imglen = img->line[current_lno+i].len;\n \n-\t\tif (!fuzzy_matchlines(img->buf + try + imgoff, imglen,\n+\t\tif (!fuzzy_matchlines(img->buf + current + imgoff, imglen,\n \t\t\t\t      preimage->buf + preoff, prelen))\n \t\t\treturn 0;\n \t\tif (preimage->line[i].flag & LINE_COMMON)\n@@ -2443,7 +2443,7 @@ static int line_by_line_fuzzy_match(struct image *img,\n \t */\n \textra_chars = preimage_end - preimage_eof;\n \tstrbuf_init(&fixed, imgoff + extra_chars);\n-\tstrbuf_add(&fixed, img->buf + try, imgoff);\n+\tstrbuf_add(&fixed, img->buf + current, imgoff);\n \tstrbuf_add(&fixed, preimage_eof, extra_chars);\n \tfixed_buf = strbuf_detach(&fixed, &fixed_len);\n \tupdate_pre_post_images(preimage, postimage,\n@@ -2455,8 +2455,8 @@ static int match_fragment(struct apply_state *state,\n \t\t\t  struct image *img,\n \t\t\t  struct image *preimage,\n \t\t\t  struct image *postimage,\n-\t\t\t  unsigned long try,\n-\t\t\t  int try_lno,\n+\t\t\t  unsigned long current,\n+\t\t\t  int current_lno,\n \t\t\t  unsigned ws_rule,\n \t\t\t  int match_beginning, int match_end)\n {\n@@ -2466,12 +2466,12 @@ static int match_fragment(struct apply_state *state,\n \tsize_t fixed_len, postlen;\n \tint preimage_limit;\n \n-\tif (preimage->nr + try_lno <= img->nr) {\n+\tif (preimage->nr + current_lno <= img->nr) {\n \t\t/*\n \t\t * The hunk falls within the boundaries of img.\n \t\t */\n \t\tpreimage_limit = preimage->nr;\n-\t\tif (match_end && (preimage->nr + try_lno != img->nr))\n+\t\tif (match_end && (preimage->nr + current_lno != img->nr))\n \t\t\treturn 0;\n \t} else if (state->ws_error_action == correct_ws_error &&\n \t\t   (ws_rule & WS_BLANK_AT_EOF)) {\n@@ -2482,7 +2482,7 @@ static int match_fragment(struct apply_state *state,\n \t\t * match with img, and the remainder of the preimage\n \t\t * must be blank.\n \t\t */\n-\t\tpreimage_limit = img->nr - try_lno;\n+\t\tpreimage_limit = img->nr - current_lno;\n \t} else {\n \t\t/*\n \t\t * The hunk extends beyond the end of the img and\n@@ -2492,27 +2492,27 @@ static int match_fragment(struct apply_state *state,\n \t\treturn 0;\n \t}\n \n-\tif (match_beginning && try_lno)\n+\tif (match_beginning && current_lno)\n \t\treturn 0;\n \n \t/* Quick hash check */\n \tfor (i = 0; i < preimage_limit; i++)\n-\t\tif ((img->line[try_lno + i].flag & LINE_PATCHED) ||\n-\t\t    (preimage->line[i].hash != img->line[try_lno + i].hash))\n+\t\tif ((img->line[current_lno + i].flag & LINE_PATCHED) ||\n+\t\t    (preimage->line[i].hash != img->line[current_lno + i].hash))\n \t\t\treturn 0;\n \n \tif (preimage_limit == preimage->nr) {\n \t\t/*\n \t\t * Do we have an exact match?  If we were told to match\n-\t\t * at the end, size must be exactly at try+fragsize,\n-\t\t * otherwise try+fragsize must be still within the preimage,\n+\t\t * at the end, size must be exactly at current+fragsize,\n+\t\t * otherwise current+fragsize must be still within the preimage,\n \t\t * and either case, the old piece should match the preimage\n \t\t * exactly.\n \t\t */\n \t\tif ((match_end\n-\t\t     ? (try + preimage->len == img->len)\n-\t\t     : (try + preimage->len <= img->len)) &&\n-\t\t    !memcmp(img->buf + try, preimage->buf, preimage->len))\n+\t\t     ? (current + preimage->len == img->len)\n+\t\t     : (current + preimage->len <= img->len)) &&\n+\t\t    !memcmp(img->buf + current, preimage->buf, preimage->len))\n \t\t\treturn 1;\n \t} else {\n \t\t/*\n@@ -2543,7 +2543,7 @@ static int match_fragment(struct apply_state *state,\n \t */\n \tif (state->ws_ignore_action == ignore_ws_change)\n \t\treturn line_by_line_fuzzy_match(img, preimage, postimage,\n-\t\t\t\t\t\ttry, try_lno, preimage_limit);\n+\t\t\t\t\t\tcurrent, current_lno, preimage_limit);\n \n \tif (state->ws_error_action != correct_ws_error)\n \t\treturn 0;\n@@ -2577,10 +2577,10 @@ static int match_fragment(struct apply_state *state,\n \t */\n \tstrbuf_init(&fixed, preimage->len + 1);\n \torig = preimage->buf;\n-\ttarget = img->buf + try;\n+\ttarget = img->buf + current;\n \tfor (i = 0; i < preimage_limit; i++) {\n \t\tsize_t oldlen = preimage->line[i].len;\n-\t\tsize_t tgtlen = img->line[try_lno + i].len;\n+\t\tsize_t tgtlen = img->line[current_lno + i].len;\n \t\tsize_t fixstart = fixed.len;\n \t\tstruct strbuf tgtfix;\n \t\tint match;\n@@ -2666,8 +2666,8 @@ static int find_pos(struct apply_state *state,\n \t\t    int match_beginning, int match_end)\n {\n \tint i;\n-\tunsigned long backwards, forwards, try;\n-\tint backwards_lno, forwards_lno, try_lno;\n+\tunsigned long backwards, forwards, current;\n+\tint backwards_lno, forwards_lno, current_lno;\n \n \t/*\n \t * If match_beginning or match_end is specified, there is no\n@@ -2687,25 +2687,25 @@ static int find_pos(struct apply_state *state,\n \tif ((size_t) line > img->nr)\n \t\tline = img->nr;\n \n-\ttry = 0;\n+\tcurrent = 0;\n \tfor (i = 0; i < line; i++)\n-\t\ttry += img->line[i].len;\n+\t\tcurrent += img->line[i].len;\n \n \t/*\n \t * There's probably some smart way to do this, but I'll leave\n \t * that to the smart and beautiful people. I'm simple and stupid.\n \t */\n-\tbackwards = try;\n+\tbackwards = current;\n \tbackwards_lno = line;\n-\tforwards = try;\n+\tforwards = current;\n \tforwards_lno = line;\n-\ttry_lno = line;\n+\tcurrent_lno = line;\n \n \tfor (i = 0; ; i++) {\n \t\tif (match_fragment(state, img, preimage, postimage,\n-\t\t\t\t   try, try_lno, ws_rule,\n+\t\t\t\t   current, current_lno, ws_rule,\n \t\t\t\t   match_beginning, match_end))\n-\t\t\treturn try_lno;\n+\t\t\treturn current_lno;\n \n \tagain:\n \t\tif (backwards_lno == 0 && forwards_lno == img->nr)\n@@ -2718,8 +2718,8 @@ static int find_pos(struct apply_state *state,\n \t\t\t}\n \t\t\tbackwards_lno--;\n \t\t\tbackwards -= img->line[backwards_lno].len;\n-\t\t\ttry = backwards;\n-\t\t\ttry_lno = backwards_lno;\n+\t\t\tcurrent = backwards;\n+\t\t\tcurrent_lno = backwards_lno;\n \t\t} else {\n \t\t\tif (forwards_lno == img->nr) {\n \t\t\t\ti++;\n@@ -2727,8 +2727,8 @@ static int find_pos(struct apply_state *state,\n \t\t\t}\n \t\t\tforwards += img->line[forwards_lno].len;\n \t\t\tforwards_lno++;\n-\t\t\ttry = forwards;\n-\t\t\ttry_lno = forwards_lno;\n+\t\t\tcurrent = forwards;\n+\t\t\tcurrent_lno = forwards_lno;\n \t\t}\n \n \t}\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339382","messageId":"20180214185959.221906-15-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 14/37] combine-diff: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:36Z","receivedAt":"2018-02-14T19:02:52Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n combine-diff.c | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex bc08c4c5b..14db48966 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -162,7 +162,7 @@ enum coalesce_direction { MATCH, BASE, NEW };\n \n /* Coalesce new lines into base by finding LCS */\n static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n-\t\t\t\t    struct lline *new, int lennew,\n+\t\t\t\t    struct lline *newline, int lennew,\n \t\t\t\t    unsigned long parent, long flags)\n {\n \tint **lcs;\n@@ -170,12 +170,12 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \tstruct lline *baseend, *newend = NULL;\n \tint i, j, origbaselen = *lenbase;\n \n-\tif (new == NULL)\n+\tif (newline == NULL)\n \t\treturn base;\n \n \tif (base == NULL) {\n \t\t*lenbase = lennew;\n-\t\treturn new;\n+\t\treturn newline;\n \t}\n \n \t/*\n@@ -200,7 +200,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \t\tdirections[0][j] = NEW;\n \n \tfor (i = 1, baseend = base; i < origbaselen + 1; i++) {\n-\t\tfor (j = 1, newend = new; j < lennew + 1; j++) {\n+\t\tfor (j = 1, newend = newline; j < lennew + 1; j++) {\n \t\t\tif (match_string_spaces(baseend->line, baseend->len,\n \t\t\t\t\t\tnewend->line, newend->len, flags)) {\n \t\t\t\tlcs[i][j] = lcs[i - 1][j - 1] + 1;\n@@ -241,7 +241,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \t\t\tif (lline->prev)\n \t\t\t\tlline->prev->next = lline->next;\n \t\t\telse\n-\t\t\t\tnew = lline->next;\n+\t\t\t\tnewline = lline->next;\n \t\t\tif (lline->next)\n \t\t\t\tlline->next->prev = lline->prev;\n \n@@ -270,7 +270,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,\n \t\t}\n \t}\n \n-\tnewend = new;\n+\tnewend = newline;\n \twhile (newend) {\n \t\tstruct lline *lline = newend;\n \t\tnewend = newend->next;\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339383","messageId":"20180214185959.221906-9-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 08/37] apply: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:30Z","receivedAt":"2018-02-14T19:02:54Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n apply.c | 54 +++++++++++++++++++++++++++---------------------------\n 1 file changed, 27 insertions(+), 27 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 071f653c6..e9f34dceb 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,\n \t\t\t\t   size_t len, size_t postlen)\n {\n \tint i, ctx, reduced;\n-\tchar *new, *old, *fixed;\n+\tchar *new_buf, *old_buf, *fixed;\n \tstruct image fixed_preimage;\n \n \t/*\n@@ -2327,25 +2327,25 @@ static void update_pre_post_images(struct image *preimage,\n \t * We trust the caller to tell us if the update can be done\n \t * in place (postlen==0) or not.\n \t */\n-\told = postimage->buf;\n+\told_buf = postimage->buf;\n \tif (postlen)\n-\t\tnew = postimage->buf = xmalloc(postlen);\n+\t\tnew_buf = postimage->buf = xmalloc(postlen);\n \telse\n-\t\tnew = old;\n+\t\tnew_buf = old_buf;\n \tfixed = preimage->buf;\n \n \tfor (i = reduced = ctx = 0; i < postimage->nr; i++) {\n \t\tsize_t l_len = postimage->line[i].len;\n \t\tif (!(postimage->line[i].flag & LINE_COMMON)) {\n \t\t\t/* an added line -- no counterparts in preimage */\n-\t\t\tmemmove(new, old, l_len);\n-\t\t\told += l_len;\n-\t\t\tnew += l_len;\n+\t\t\tmemmove(new_buf, old_buf, l_len);\n+\t\t\told_buf += l_len;\n+\t\t\tnew_buf += l_len;\n \t\t\tcontinue;\n \t\t}\n \n \t\t/* a common context -- skip it in the original postimage */\n-\t\told += l_len;\n+\t\told_buf += l_len;\n \n \t\t/* and find the corresponding one in the fixed preimage */\n \t\twhile (ctx < preimage->nr &&\n@@ -2365,21 +2365,21 @@ static void update_pre_post_images(struct image *preimage,\n \n \t\t/* and copy it in, while fixing the line length */\n \t\tl_len = preimage->line[ctx].len;\n-\t\tmemcpy(new, fixed, l_len);\n-\t\tnew += l_len;\n+\t\tmemcpy(new_buf, fixed, l_len);\n+\t\tnew_buf += l_len;\n \t\tfixed += l_len;\n \t\tpostimage->line[i].len = l_len;\n \t\tctx++;\n \t}\n \n \tif (postlen\n-\t    ? postlen < new - postimage->buf\n-\t    : postimage->len < new - postimage->buf)\n+\t    ? postlen < new_buf - postimage->buf\n+\t    : postimage->len < new_buf - postimage->buf)\n \t\tdie(\"BUG: caller miscounted postlen: asked %d, orig = %d, used = %d\",\n-\t\t    (int)postlen, (int) postimage->len, (int)(new - postimage->buf));\n+\t\t    (int)postlen, (int) postimage->len, (int)(new_buf - postimage->buf));\n \n \t/* Fix the length of the whole thing */\n-\tpostimage->len = new - postimage->buf;\n+\tpostimage->len = new_buf - postimage->buf;\n \tpostimage->nr -= reduced;\n }\n \n@@ -4163,30 +4163,30 @@ static void show_mode_change(struct patch *p, int show_name)\n static void show_rename_copy(struct patch *p)\n {\n \tconst char *renamecopy = p->is_rename ? \"rename\" : \"copy\";\n-\tconst char *old, *new;\n+\tconst char *old_name, *new_name;\n \n \t/* Find common prefix */\n-\told = p->old_name;\n-\tnew = p->new_name;\n+\told_name = p->old_name;\n+\tnew_name = p->new_name;\n \twhile (1) {\n \t\tconst char *slash_old, *slash_new;\n-\t\tslash_old = strchr(old, '/');\n-\t\tslash_new = strchr(new, '/');\n+\t\tslash_old = strchr(old_name, '/');\n+\t\tslash_new = strchr(new_name, '/');\n \t\tif (!slash_old ||\n \t\t    !slash_new ||\n-\t\t    slash_old - old != slash_new - new ||\n-\t\t    memcmp(old, new, slash_new - new))\n+\t\t    slash_old - old_name != slash_new - new_name ||\n+\t\t    memcmp(old_name, new_name, slash_new - new_name))\n \t\t\tbreak;\n-\t\told = slash_old + 1;\n-\t\tnew = slash_new + 1;\n+\t\told_name = slash_old + 1;\n+\t\tnew_name = slash_new + 1;\n \t}\n-\t/* p->old_name thru old is the common prefix, and old and new\n+\t/* p->old_name thru old_name is the common prefix, and old_name and new_name\n \t * through the end of names are renames\n \t */\n-\tif (old != p->old_name)\n+\tif (old_name != p->old_name)\n \t\tprintf(\" %s %.*s{%s => %s} (%d%%)\\n\", renamecopy,\n-\t\t       (int)(old - p->old_name), p->old_name,\n-\t\t       old, new, p->score);\n+\t\t       (int)(old_name - p->old_name), p->old_name,\n+\t\t       old_name, new_name, p->score);\n \telse\n \t\tprintf(\" %s %s => %s (%d%%)\\n\", renamecopy,\n \t\t       p->old_name, p->new_name, p->score);\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339384","messageId":"20180214185959.221906-14-bmwill@google.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"[PATCH v2 13/37] remote: rename 'new' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T18:59:35Z","receivedAt":"2018-02-14T19:02:56Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Rename C++ keyword in order to bring the codebase closer to being able\nto be compiled with a C++ compiler.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/remote.c | 66 ++++++++++++++++++++++++------------------------\n 1 file changed, 33 insertions(+), 33 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex d95bf904c..6487d92ab 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -322,7 +322,7 @@ static void read_branches(void)\n \n struct ref_states {\n \tstruct remote *remote;\n-\tstruct string_list new, stale, tracked, heads, push;\n+\tstruct string_list new_refs, stale, tracked, heads, push;\n \tint queried;\n };\n \n@@ -337,12 +337,12 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat\n \t\t\tdie(_(\"Could not get fetch map for refspec %s\"),\n \t\t\t\tstates->remote->fetch_refspec[i]);\n \n-\tstates->new.strdup_strings = 1;\n+\tstates->new_refs.strdup_strings = 1;\n \tstates->tracked.strdup_strings = 1;\n \tstates->stale.strdup_strings = 1;\n \tfor (ref = fetch_map; ref; ref = ref->next) {\n \t\tif (!ref->peer_ref || !ref_exists(ref->peer_ref->name))\n-\t\t\tstring_list_append(&states->new, abbrev_branch(ref->name));\n+\t\t\tstring_list_append(&states->new_refs, abbrev_branch(ref->name));\n \t\telse\n \t\t\tstring_list_append(&states->tracked, abbrev_branch(ref->name));\n \t}\n@@ -356,7 +356,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat\n \tfree_refs(stale_refs);\n \tfree_refs(fetch_map);\n \n-\tstring_list_sort(&states->new);\n+\tstring_list_sort(&states->new_refs);\n \tstring_list_sort(&states->tracked);\n \tstring_list_sort(&states->stale);\n \n@@ -546,8 +546,8 @@ static int add_branch_for_removal(const char *refname,\n }\n \n struct rename_info {\n-\tconst char *old;\n-\tconst char *new;\n+\tconst char *old_name;\n+\tconst char *new_name;\n \tstruct string_list *remote_branches;\n };\n \n@@ -560,7 +560,7 @@ static int read_remote_branches(const char *refname,\n \tint flag;\n \tconst char *symref;\n \n-\tstrbuf_addf(&buf, \"refs/remotes/%s/\", rename->old);\n+\tstrbuf_addf(&buf, \"refs/remotes/%s/\", rename->old_name);\n \tif (starts_with(refname, buf.buf)) {\n \t\titem = string_list_append(rename->remote_branches, xstrdup(refname));\n \t\tsymref = resolve_ref_unsafe(refname, RESOLVE_REF_READING,\n@@ -615,36 +615,36 @@ static int mv(int argc, const char **argv)\n \tif (argc != 3)\n \t\tusage_with_options(builtin_remote_rename_usage, options);\n \n-\trename.old = argv[1];\n-\trename.new = argv[2];\n+\trename.old_name = argv[1];\n+\trename.new_name = argv[2];\n \trename.remote_branches = &remote_branches;\n \n-\toldremote = remote_get(rename.old);\n+\toldremote = remote_get(rename.old_name);\n \tif (!remote_is_configured(oldremote, 1))\n-\t\tdie(_(\"No such remote: %s\"), rename.old);\n+\t\tdie(_(\"No such remote: %s\"), rename.old_name);\n \n-\tif (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)\n+\tif (!strcmp(rename.old_name, rename.new_name) && oldremote->origin != REMOTE_CONFIG)\n \t\treturn migrate_file(oldremote);\n \n-\tnewremote = remote_get(rename.new);\n+\tnewremote = remote_get(rename.new_name);\n \tif (remote_is_configured(newremote, 1))\n-\t\tdie(_(\"remote %s already exists.\"), rename.new);\n+\t\tdie(_(\"remote %s already exists.\"), rename.new_name);\n \n-\tstrbuf_addf(&buf, \"refs/heads/test:refs/remotes/%s/test\", rename.new);\n+\tstrbuf_addf(&buf, \"refs/heads/test:refs/remotes/%s/test\", rename.new_name);\n \tif (!valid_fetch_refspec(buf.buf))\n-\t\tdie(_(\"'%s' is not a valid remote name\"), rename.new);\n+\t\tdie(_(\"'%s' is not a valid remote name\"), rename.new_name);\n \n \tstrbuf_reset(&buf);\n-\tstrbuf_addf(&buf, \"remote.%s\", rename.old);\n-\tstrbuf_addf(&buf2, \"remote.%s\", rename.new);\n+\tstrbuf_addf(&buf, \"remote.%s\", rename.old_name);\n+\tstrbuf_addf(&buf2, \"remote.%s\", rename.new_name);\n \tif (git_config_rename_section(buf.buf, buf2.buf) < 1)\n \t\treturn error(_(\"Could not rename config section '%s' to '%s'\"),\n \t\t\t\tbuf.buf, buf2.buf);\n \n \tstrbuf_reset(&buf);\n-\tstrbuf_addf(&buf, \"remote.%s.fetch\", rename.new);\n+\tstrbuf_addf(&buf, \"remote.%s.fetch\", rename.new_name);\n \tgit_config_set_multivar(buf.buf, NULL, NULL, 1);\n-\tstrbuf_addf(&old_remote_context, \":refs/remotes/%s/\", rename.old);\n+\tstrbuf_addf(&old_remote_context, \":refs/remotes/%s/\", rename.old_name);\n \tfor (i = 0; i < oldremote->fetch_refspec_nr; i++) {\n \t\tchar *ptr;\n \n@@ -655,8 +655,8 @@ static int mv(int argc, const char **argv)\n \t\t\trefspec_updated = 1;\n \t\t\tstrbuf_splice(&buf2,\n \t\t\t\t      ptr-buf2.buf + strlen(\":refs/remotes/\"),\n-\t\t\t\t      strlen(rename.old), rename.new,\n-\t\t\t\t      strlen(rename.new));\n+\t\t\t\t      strlen(rename.old_name), rename.new_name,\n+\t\t\t\t      strlen(rename.new_name));\n \t\t} else\n \t\t\twarning(_(\"Not updating non-default fetch refspec\\n\"\n \t\t\t\t  \"\\t%s\\n\"\n@@ -670,10 +670,10 @@ static int mv(int argc, const char **argv)\n \tfor (i = 0; i < branch_list.nr; i++) {\n \t\tstruct string_list_item *item = branch_list.items + i;\n \t\tstruct branch_info *info = item->util;\n-\t\tif (info->remote_name && !strcmp(info->remote_name, rename.old)) {\n+\t\tif (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.remote\", item->string);\n-\t\t\tgit_config_set(buf.buf, rename.new);\n+\t\t\tgit_config_set(buf.buf, rename.new_name);\n \t\t}\n \t}\n \n@@ -703,8 +703,8 @@ static int mv(int argc, const char **argv)\n \t\t\tcontinue;\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addstr(&buf, item->string);\n-\t\tstrbuf_splice(&buf, strlen(\"refs/remotes/\"), strlen(rename.old),\n-\t\t\t\trename.new, strlen(rename.new));\n+\t\tstrbuf_splice(&buf, strlen(\"refs/remotes/\"), strlen(rename.old_name),\n+\t\t\t\trename.new_name, strlen(rename.new_name));\n \t\tstrbuf_reset(&buf2);\n \t\tstrbuf_addf(&buf2, \"remote: renamed %s to %s\",\n \t\t\t\titem->string, buf.buf);\n@@ -718,12 +718,12 @@ static int mv(int argc, const char **argv)\n \t\t\tcontinue;\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addstr(&buf, item->string);\n-\t\tstrbuf_splice(&buf, strlen(\"refs/remotes/\"), strlen(rename.old),\n-\t\t\t\trename.new, strlen(rename.new));\n+\t\tstrbuf_splice(&buf, strlen(\"refs/remotes/\"), strlen(rename.old_name),\n+\t\t\t\trename.new_name, strlen(rename.new_name));\n \t\tstrbuf_reset(&buf2);\n \t\tstrbuf_addstr(&buf2, item->util);\n-\t\tstrbuf_splice(&buf2, strlen(\"refs/remotes/\"), strlen(rename.old),\n-\t\t\t\trename.new, strlen(rename.new));\n+\t\tstrbuf_splice(&buf2, strlen(\"refs/remotes/\"), strlen(rename.old_name),\n+\t\t\t\trename.new_name, strlen(rename.new_name));\n \t\tstrbuf_reset(&buf3);\n \t\tstrbuf_addf(&buf3, \"remote: renamed %s to %s\",\n \t\t\t\titem->string, buf.buf);\n@@ -822,7 +822,7 @@ static void clear_push_info(void *util, const char *string)\n \n static void free_remote_ref_states(struct ref_states *states)\n {\n-\tstring_list_clear(&states->new, 0);\n+\tstring_list_clear(&states->new_refs, 0);\n \tstring_list_clear(&states->stale, 1);\n \tstring_list_clear(&states->tracked, 0);\n \tstring_list_clear(&states->heads, 0);\n@@ -907,7 +907,7 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)\n \tif (states->queried) {\n \t\tconst char *fmt = \"%s\";\n \t\tconst char *arg = \"\";\n-\t\tif (string_list_has_string(&states->new, name)) {\n+\t\tif (string_list_has_string(&states->new_refs, name)) {\n \t\t\tfmt = _(\" new (next fetch will store in remotes/%s)\");\n \t\t\targ = states->remote->name;\n \t\t} else if (string_list_has_string(&states->tracked, name))\n@@ -1176,7 +1176,7 @@ static int show(int argc, const char **argv)\n \n \t\t/* remote branch info */\n \t\tinfo.width = 0;\n-\t\tfor_each_string_list(&states.new, add_remote_to_show_info, &info);\n+\t\tfor_each_string_list(&states.new_refs, add_remote_to_show_info, &info);\n \t\tfor_each_string_list(&states.tracked, add_remote_to_show_info, &info);\n \t\tfor_each_string_list(&states.stale, add_remote_to_show_info, &info);\n \t\tif (info.list->nr)\n-- \n2.16.1.291.g4437f3f132-goog\n\n"},{"id":"339394","messageId":"xmqqh8qjmfq5.fsf@gitster-ct.c.googlers.com","threadId":"47717","inReplyTo":"20180214185959.221906-7-bmwill@google.com","subject":"Re: [PATCH v2 06/37] diff: rename 'this' variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-14T21:19:30Z","receivedAt":"2018-02-14T21:19:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Williams <bmwill@google.com> writes:\n\n> Rename C++ keyword in order to bring the codebase closer to being able\n> to be compiled with a C++ compiler.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n\nThe patch is not as bad as renaming \"this\" and leaving \"that\" behind\nbut in the original, \"this\" and \"this_dir\" were treated as a pair.\n\"this\" was a score for a single item in the directory, \"this_dir\"\nwas the sum of these scores for entries in the directory.\n\nSo renaming \"this\" to \"sum\" and leaving \"this_dir\" as-is looks like\nreadability regression.  Perhaps replace \"this_dir\" with \"sum_changes\"\nand \"this\" with \"changes\" instead, or something like that?\n\n>  diff.c | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/diff.c b/diff.c\n> index 0a9a0cdf1..d682d0d1f 100644\n> --- a/diff.c\n> +++ b/diff.c\n> @@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n>  \twhile (dir->nr) {\n>  \t\tstruct dirstat_file *f = dir->files;\n>  \t\tint namelen = strlen(f->name);\n> -\t\tunsigned long this;\n> +\t\tunsigned long sum;\n>  \t\tchar *slash;\n>  \n>  \t\tif (namelen < baselen)\n> @@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n>  \t\tslash = strchr(f->name + baselen, '/');\n>  \t\tif (slash) {\n>  \t\t\tint newbaselen = slash + 1 - f->name;\n> -\t\t\tthis = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n> +\t\t\tsum = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n>  \t\t\tsources++;\n>  \t\t} else {\n> -\t\t\tthis = f->changed;\n> +\t\t\tsum = f->changed;\n>  \t\t\tdir->files++;\n>  \t\t\tdir->nr--;\n>  \t\t\tsources += 2;\n>  \t\t}\n> -\t\tthis_dir += this;\n> +\t\tthis_dir += sum;\n>  \t}\n>  \n>  \t/*\n"},{"id":"339395","messageId":"20180214212438.GC139458@google.com","threadId":"47717","inReplyTo":"xmqqh8qjmfq5.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v2 06/37] diff: rename 'this' variables","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2018-02-14T21:24:38Z","receivedAt":"2018-02-14T21:24:47Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 02/14, Junio C Hamano wrote:\n> Brandon Williams <bmwill@google.com> writes:\n> \n> > Rename C++ keyword in order to bring the codebase closer to being able\n> > to be compiled with a C++ compiler.\n> >\n> > Signed-off-by: Brandon Williams <bmwill@google.com>\n> > ---\n> \n> The patch is not as bad as renaming \"this\" and leaving \"that\" behind\n> but in the original, \"this\" and \"this_dir\" were treated as a pair.\n> \"this\" was a score for a single item in the directory, \"this_dir\"\n> was the sum of these scores for entries in the directory.\n> \n> So renaming \"this\" to \"sum\" and leaving \"this_dir\" as-is looks like\n> readability regression.  Perhaps replace \"this_dir\" with \"sum_changes\"\n> and \"this\" with \"changes\" instead, or something like that?\n\n100% agree.  I tried to spend time on each of these changes to come up\nwith a meaningful name, but sometimes wasn't able to understand the\nsection of code (with the limited context I had with some areas) and\nwasn't able to come up with the best name.  I'll change this.\n\n> \n> >  diff.c | 8 ++++----\n> >  1 file changed, 4 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/diff.c b/diff.c\n> > index 0a9a0cdf1..d682d0d1f 100644\n> > --- a/diff.c\n> > +++ b/diff.c\n> > @@ -2601,7 +2601,7 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n> >  \twhile (dir->nr) {\n> >  \t\tstruct dirstat_file *f = dir->files;\n> >  \t\tint namelen = strlen(f->name);\n> > -\t\tunsigned long this;\n> > +\t\tunsigned long sum;\n> >  \t\tchar *slash;\n> >  \n> >  \t\tif (namelen < baselen)\n> > @@ -2611,15 +2611,15 @@ static long gather_dirstat(struct diff_options *opt, struct dirstat_dir *dir,\n> >  \t\tslash = strchr(f->name + baselen, '/');\n> >  \t\tif (slash) {\n> >  \t\t\tint newbaselen = slash + 1 - f->name;\n> > -\t\t\tthis = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n> > +\t\t\tsum = gather_dirstat(opt, dir, changed, f->name, newbaselen);\n> >  \t\t\tsources++;\n> >  \t\t} else {\n> > -\t\t\tthis = f->changed;\n> > +\t\t\tsum = f->changed;\n> >  \t\t\tdir->files++;\n> >  \t\t\tdir->nr--;\n> >  \t\t\tsources += 2;\n> >  \t\t}\n> > -\t\tthis_dir += this;\n> > +\t\tthis_dir += sum;\n> >  \t}\n> >  \n> >  \t/*\n\n-- \nBrandon Williams\n"},{"id":"339396","messageId":"CAGZ79kbaSmuju7Arc8FLPtHG0i5ivFeSX=i_x2uZUahQeNS+Dg@mail.gmail.com","threadId":"47717","inReplyTo":"20180214185959.221906-9-bmwill@google.com","subject":"Re: [PATCH v2 08/37] apply: rename 'new' variables","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-14T21:40:07Z","receivedAt":"2018-02-14T21:40:14Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Feb 14, 2018 at 10:59 AM, Brandon Williams <bmwill@google.com> wrote:\n> Rename C++ keyword in order to bring the codebase closer to being able\n> to be compiled with a C++ compiler.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n>  apply.c | 54 +++++++++++++++++++++++++++---------------------------\n>  1 file changed, 27 insertions(+), 27 deletions(-)\n>\n> diff --git a/apply.c b/apply.c\n> index 071f653c6..e9f34dceb 100644\n> --- a/apply.c\n> +++ b/apply.c\n> @@ -2301,7 +2301,7 @@ static void update_pre_post_images(struct image *preimage,\n>                                    size_t len, size_t postlen)\n>  {\n>         int i, ctx, reduced;\n> -       char *new, *old, *fixed;\n> +       char *new_buf, *old_buf, *fixed;\n\n*_buf makes it sound like it could be a strbuf at first,\nbut it is just a buffer. That is ok, as we take over a buffer from\n'postimage->buf'. I was suggesting a new name, but given that\nreuse of \"buf\", I guess this is fine.\n"},{"id":"339407","messageId":"CAGZ79ka7b_+o3p9P5oGmCoh6dJdqYx6Rwv=fetKavcgBhztgSw@mail.gmail.com","threadId":"47717","inReplyTo":"20180214185959.221906-1-bmwill@google.com","subject":"Re: [PATCH v2 00/37] removal of some c++ keywords","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-14T22:41:16Z","receivedAt":"2018-02-14T22:41:22Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Feb 14, 2018 at 10:59 AM, Brandon Williams <bmwill@google.com> wrote:\n> One person was interested enough for me to go back through and also\n> rename all the paired 'old' variables to match the new names for the\n> variables which were named 'new'.\n\nThe patches are:\nReviewed-by: Stefan Beller <sbeller@google.com>\n(apart from the 'this' nit Junio had)\n"}]}