Re: [PATCH] clean up and optimize nth_packed_object_sha1() usage
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Apr 5, 2007, 06:27 UTC
- Message-ID
- <20070405062753.GC5436@spearce.org>
- In-Reply-To
- <alpine.LFD.0.98.0704041639070.28181@xanadu.home>
Nicolas Pitre <nico@cam.org> wrote:
Show 6 quoted lines
> Let's avoid the open coded pack index reference in pack-object and use > nth_packed_object_sha1() instead. This will help encapsulating index > format differences in one place. > > And while at it there is no reason to copy SHA1's over and over while a > direct pointer to it in the index will do just fine.
Ack++. ;-)
This is a good change. That API has been bothering me for a while.
Show 9 quoted lines
> @@ -96,14 +96,14 @@ static int find_short_packed_object(int len, const unsigned char *match, unsigne
> last = mid;
> }
> if (first < num) {
> - unsigned char now[20], next[20];
> - nth_packed_object_sha1(p, first, now);
> + const unsigned char *now, *next;
> + now = nth_packed_object_sha1(p, first);
> if (match_sha(len, match, now)) {Uh, there is some sort of werid whitespace indent damage on that second added line. It doesn't line up with the first added line, or with either of the context lines.
-- Shawn.