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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sat, 4 Apr 2009, Christian Couder wrote:

> instead of the specific one that was simpler but less efficient.
> 
> Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
> ---
>  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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux