git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Nicolas Pitre
Message 2 of 2 in “clean up and optimize nth_packed_object_sha1() usage”
  1. clean up and optimize nth_packed_object_sha1() usageNicolas Pitre, Apr 4, 2007
  2. Shawn O. PearceApr 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.