{"thread":{"id":"18996","subject":"[PATCH 1/2] Localizing temporary variables","startedAt":"2009-04-22T06:00:36Z","lastAt":"2009-04-22T06:00:37Z","messageCount":2,"participants":["andy@petdance.com"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"111924","messageId":"1240380037-24785-1-git-send-email-andy@petdance.com","threadId":"18996","inReplyTo":null,"subject":"[PATCH 1/2] Localizing temporary variables","fromName":"","fromEmail":"andy@petdance.com","sentAt":"2009-04-22T06:00:36Z","receivedAt":"2009-04-22T06:00:36Z","isPatch":true,"sender":{"key":"andy@petdance.com","avatar":"https://gravatar.com/avatar/997ccaea115635c2be5051f455bbe6287c0f13aa59c96e1d6eb21ba3589239fb?d=mp&s=160"},"body":"From: Andy Lester <andy@petdance.com>\n\n---\n builtin-show-ref.c |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-show-ref.c b/builtin-show-ref.c\nindex dc76c50..3dc8fe2 100644\n--- a/builtin-show-ref.c\n+++ b/builtin-show-ref.c\n@@ -22,8 +22,6 @@ static void show_one(const char *refname, const unsigned char *sha1)\n \n static int show_ref(const char *refname, const unsigned char *sha1, int flag, void *cbdata)\n {\n-\tstruct object *obj;\n-\tconst char *hex;\n \tunsigned char peeled[20];\n \n \tif (tags_only || heads_only) {\n@@ -75,16 +73,19 @@ match:\n \n \tif ((flag & REF_ISPACKED) && !peel_ref(refname, peeled)) {\n \t\tif (!is_null_sha1(peeled)) {\n+\t\t\tconst char *hex;\n \t\t\thex = find_unique_abbrev(peeled, abbrev);\n \t\t\tprintf(\"%s %s^{}\\n\", hex, refname);\n \t\t}\n \t}\n \telse {\n+\t\tstruct object *obj;\n \t\tobj = parse_object(sha1);\n \t\tif (!obj)\n \t\t\tdie(\"git show-ref: bad ref %s (%s)\", refname,\n \t\t\t    sha1_to_hex(sha1));\n \t\tif (obj->type == OBJ_TAG) {\n+\t\t\tconst char *hex;\n \t\t\tobj = deref_tag(obj, refname, 0);\n \t\t\tif (!obj)\n \t\t\t\tdie(\"git show-ref: bad tag at ref %s (%s)\", refname,\n-- \n1.6.2.4\n"},{"id":"111925","messageId":"1240380037-24785-2-git-send-email-andy@petdance.com","threadId":"18996","inReplyTo":"1240380037-24785-1-git-send-email-andy@petdance.com","subject":"[PATCH 2/2] Applying const to arg for rev_is_head(). Localized a work variable.","fromName":"","fromEmail":"andy@petdance.com","sentAt":"2009-04-22T06:00:37Z","receivedAt":"2009-04-22T06:00:37Z","isPatch":true,"sender":{"key":"andy@petdance.com","avatar":"https://gravatar.com/avatar/997ccaea115635c2be5051f455bbe6287c0f13aa59c96e1d6eb21ba3589239fb?d=mp&s=160"},"body":"From: Andy Lester <andy@petdance.com>\n\n---\n builtin-show-branch.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-show-branch.c b/builtin-show-branch.c\nindex 828e6f8..549f99a 100644\n--- a/builtin-show-branch.c\n+++ b/builtin-show-branch.c\n@@ -261,7 +261,6 @@ static void show_one_commit(struct commit *commit, int no_name)\n {\n \tstruct strbuf pretty = STRBUF_INIT;\n \tconst char *pretty_str = \"(unavailable)\";\n-\tstruct commit_name *name = commit->util;\n \n \tif (commit->object.parsed) {\n \t\tpretty_print_commit(CMIT_FMT_ONELINE, commit,\n@@ -272,6 +271,7 @@ static void show_one_commit(struct commit *commit, int no_name)\n \t\tpretty_str += 8;\n \n \tif (!no_name) {\n+\t\tstruct commit_name *name = commit->util;\n \t\tif (name && name->head_name) {\n \t\t\tprintf(\"[%s\", name->head_name);\n \t\t\tif (name->generation) {\n@@ -456,7 +456,7 @@ static void snarf_refs(int head, int remotes)\n \t}\n }\n \n-static int rev_is_head(char *head, int headlen, char *name,\n+static int rev_is_head(const char *head, int headlen, const char *name,\n \t\t       unsigned char *head_sha1, unsigned char *sha1)\n {\n \tif ((!head[0]) ||\n@@ -548,7 +548,7 @@ static int git_show_branch_config(const char *var, const char *value, void *cb)\n \treturn git_default_config(var, value, cb);\n }\n \n-static int omit_in_dense(struct commit *commit, struct commit **rev, int n)\n+static int omit_in_dense(const struct commit *commit, struct commit **rev, int n)\n {\n \t/* If the commit is tip of the named branches, do not\n \t * omit it.\n-- \n1.6.2.4\n"}]}