* [PATCH 1/2] Localizing temporary variables
@ 2009-04-22 6:00 andy
2009-04-22 6:00 ` [PATCH 2/2] Applying const to arg for rev_is_head(). Localized a work variable andy
0 siblings, 1 reply; 2+ messages in thread
From: andy @ 2009-04-22 6:00 UTC (permalink / raw)
To: git; +Cc: gitster, Andy Lester
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] Applying const to arg for rev_is_head(). Localized a work variable.
2009-04-22 6:00 [PATCH 1/2] Localizing temporary variables andy
@ 2009-04-22 6:00 ` andy
0 siblings, 0 replies; 2+ messages in thread
From: andy @ 2009-04-22 6:00 UTC (permalink / raw)
To: git; +Cc: gitster, Andy Lester
From: Andy Lester <andy@petdance.com>
---
builtin-show-branch.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 828e6f8..549f99a 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -261,7 +261,6 @@ static void show_one_commit(struct commit *commit, int no_name)
{
struct strbuf pretty = STRBUF_INIT;
const char *pretty_str = "(unavailable)";
- struct commit_name *name = commit->util;
if (commit->object.parsed) {
pretty_print_commit(CMIT_FMT_ONELINE, commit,
@@ -272,6 +271,7 @@ static void show_one_commit(struct commit *commit, int no_name)
pretty_str += 8;
if (!no_name) {
+ struct commit_name *name = commit->util;
if (name && name->head_name) {
printf("[%s", name->head_name);
if (name->generation) {
@@ -456,7 +456,7 @@ static void snarf_refs(int head, int remotes)
}
}
-static int rev_is_head(char *head, int headlen, char *name,
+static int rev_is_head(const char *head, int headlen, const char *name,
unsigned char *head_sha1, unsigned char *sha1)
{
if ((!head[0]) ||
@@ -548,7 +548,7 @@ static int git_show_branch_config(const char *var, const char *value, void *cb)
return git_default_config(var, value, cb);
}
-static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
+static int omit_in_dense(const struct commit *commit, struct commit **rev, int n)
{
/* If the commit is tip of the named branches, do not
* omit it.
--
1.6.2.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-22 6:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-22 6:00 [PATCH 1/2] Localizing temporary variables andy
2009-04-22 6:00 ` [PATCH 2/2] Applying const to arg for rev_is_head(). Localized a work variable andy
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).