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

Re: [PATCH 4/4] replace_object: use the new generic "sha1_pos" function to lookup sha1

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 5, 2009, 13:19 UTC
Message-ID
<alpine.DEB.1.00.0904051516170.10279@pacific.mpi-cbg.de>
In-Reply-To
<20090404225941.7fef76a7.chriscool@tuxfamily.org>
Hi,
On Sat, 4 Apr 2009, Christian Couder wrote:
Show 26 quoted lines
> instead of the specific one that was simpler but less efficient.
> 
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
>  replace_object.c |   24 +++++++++---------------
>  1 files changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/replace_object.c b/replace_object.c
> index 1227214..eb59604 100644
> --- a/replace_object.c
> +++ b/replace_object.c
> @@ -1,4 +1,5 @@
>  #include "cache.h"
> +#include "sha1-lookup.h"
>  #include "refs.h"
>  
>  static struct replace_object {
> @@ -7,23 +8,16 @@ static struct replace_object {
>  
>  static int replace_object_alloc, replace_object_nr;
>  
> +static const unsigned char *replace_sha1_access(size_t index, void *table)
> +{
> +	struct replace_object **replace = table;
> +	return replace[index]->sha1[0];
> +}

I have to agree with Junio that this is potentially slowing down things, as there is an additional redirection layer here.

If the tables are not too large, I'd prefer using a
	struct sha1_list_entry {
		unsigned char *sha1;
		void *object;
	};
Hmm.

Ciao, Dscho

Previous: Christian Couder
Message 2 of 2 in “replace_object: use the new generic "sha1_pos" function to lookup sha1”
  1. 4/4 replace_object: use the new generic "sha1_pos" function to lookup sha1Christian Couder, Apr 4, 2009
  2. Johannes SchindelinApr 5, 2009

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.