git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andy@petdance.com
To: git@vger.kernel.org
Cc: gitster@pobox.com, Andy Lester <andy@petdance.com>
Subject: [PATCH 1/2] Localizing temporary variables
Date: Wed, 22 Apr 2009 01:00:36 -0500	[thread overview]
Message-ID: <1240380037-24785-1-git-send-email-andy@petdance.com> (raw)

From: Andy Lester <andy@petdance.com>

---
 builtin-show-ref.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index dc76c50..3dc8fe2 100644
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
@@ -22,8 +22,6 @@ static void show_one(const char *refname, const unsigned char *sha1)
 
 static int show_ref(const char *refname, const unsigned char *sha1, int flag, void *cbdata)
 {
-	struct object *obj;
-	const char *hex;
 	unsigned char peeled[20];
 
 	if (tags_only || heads_only) {
@@ -75,16 +73,19 @@ match:
 
 	if ((flag & REF_ISPACKED) && !peel_ref(refname, peeled)) {
 		if (!is_null_sha1(peeled)) {
+			const char *hex;
 			hex = find_unique_abbrev(peeled, abbrev);
 			printf("%s %s^{}\n", hex, refname);
 		}
 	}
 	else {
+		struct object *obj;
 		obj = parse_object(sha1);
 		if (!obj)
 			die("git show-ref: bad ref %s (%s)", refname,
 			    sha1_to_hex(sha1));
 		if (obj->type == OBJ_TAG) {
+			const char *hex;
 			obj = deref_tag(obj, refname, 0);
 			if (!obj)
 				die("git show-ref: bad tag at ref %s (%s)", refname,
-- 
1.6.2.4

             reply	other threads:[~2009-04-22  6:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-22  6:00 andy [this message]
2009-04-22  6:00 ` [PATCH 2/2] Applying const to arg for rev_is_head(). Localized a work variable andy

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1240380037-24785-1-git-send-email-andy@petdance.com \
    --to=andy@petdance.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

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

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