From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] Correct priority of lightweight tags in git-describe.
Date: Sun, 14 Jan 2007 18:17:49 -0500 [thread overview]
Message-ID: <20070114231749.GE10888@spearce.org> (raw)
In-Reply-To: <7vodp1flrt.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> How about this on top?
>
> * We seem to do "a_" more often than "_a" for parameter names
> we type-cast.
I copied the header from the compare_names routine in
builtin-describe.c. Maybe apply this too?
-- >8 --
diff --git a/builtin-describe.c b/builtin-describe.c
index e38c899..e514bc3 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -104,10 +104,10 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void
return 0;
}
-static int compare_names(const void *_a, const void *_b)
+static int compare_names(const void *a_, const void *b_)
{
- struct commit_name *a = *(struct commit_name **)_a;
- struct commit_name *b = *(struct commit_name **)_b;
+ struct commit_name *a = *(struct commit_name **)a_;
+ struct commit_name *b = *(struct commit_name **)b_;
unsigned long a_date = a->commit->date;
unsigned long b_date = b->commit->date;
int cmp = hashcmp(a->commit->object.sha1, b->commit->object.sha1);
-- <8 --
> * int would be enough for 'depth', not long. Also, "return
> (a->depth - b->depth)" is kosher only when it is signed,
> although it works in practice on sane platforms.
I originally went with unsigned long as that matches the size
of a packfile, and I wasn't using depth in a signed way. Until
that patch. Good catch.
> * I did not find mergesort(); if we want stable, explicitly do
> so. In practice, qsort() seems stable (as you know qsort()
> does not have to be implemented as quicksort).
Must be a *BSD extension. Oops.
Patch looked good. Thanks.
--
Shawn.
prev parent reply other threads:[~2007-01-15 17:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2a044746b474f7c1840116762e79481b4669900e.1168767397.git.spearce@spearce.org>
2007-01-14 9:37 ` [PATCH 2/2] Correct priority of lightweight tags in git-describe Shawn O. Pearce
2007-01-14 19:31 ` Junio C Hamano
2007-01-14 23:17 ` Shawn O. Pearce [this message]
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=20070114231749.GE10888@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).