threads / patch / 9549

patchpack-objects: remove bogus arguments to delta_cacheable()

Subject: [PATCH] pack-objects: remove bogus arguments to delta_cacheable()

## tl;dr

2 messages between Aug 16, 2007 and Aug 16, 2007. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Nicolas Pitre· Aug 16, 2007, 02:46 UTC · lore

Not only are they unused, but the order in the function declaration and the actual usage don't match.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---
Show changes to builtin-pack-objects.c +3 −4
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 51a850e..24926db 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1273,9 +1273,8 @@ struct unpacked {
 	unsigned depth;
 };
 
-static int delta_cacheable(struct unpacked *trg, struct unpacked *src,
-			    unsigned long src_size, unsigned long trg_size,
-			    unsigned long delta_size)
+static int delta_cacheable(unsigned long src_size, unsigned long trg_size,
+			   unsigned long delta_size)
 {
 	if (max_delta_cache_size && delta_cache_size + delta_size > max_delta_cache_size)
 		return 0;
@@ -1397,7 +1396,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
 	trg_entry->delta_size = delta_size;
 	trg->depth = src->depth + 1;
 
-	if (delta_cacheable(src, trg, src_size, trg_size, delta_size)) {
+	if (delta_cacheable(src_size, trg_size, delta_size)) {
 		trg_entry->delta_data = xrealloc(delta_buf, delta_size);
 		delta_cache_size += trg_entry->delta_size;
 	} else
Martin Koegler· Aug 16, 2007, 06:18 UTC · re: Nicolas Pitre · lore

Re: [PATCH] pack-objects: remove bogus arguments to delta_cacheable()

On Wed, Aug 15, 2007 at 10:46:01PM -0400, Nicolas Pitre wrote:
> Not only are they unused, but the order in the function declaration
> and the actual usage don't match.
The wrong order of the parameters is my fault. 

I added the parameters for struct unpacked, because delta_cacheable was intended as generic policy handler, which can take any decission based on the available information of the source and the target entry (which can be found through struct unpacked).

I have no objections againsts removing them, as they can be added again, if a (new) policy algorithm needs more inforation.

Show 29 quoted lines
> 
> Signed-off-by: Nicolas Pitre <nico@cam.org>
> ---
> 
> diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
> index 51a850e..24926db 100644
> --- a/builtin-pack-objects.c
> +++ b/builtin-pack-objects.c
> @@ -1273,9 +1273,8 @@ struct unpacked {
>  	unsigned depth;
>  };
>  
> -static int delta_cacheable(struct unpacked *trg, struct unpacked *src,
> -			    unsigned long src_size, unsigned long trg_size,
> -			    unsigned long delta_size)
> +static int delta_cacheable(unsigned long src_size, unsigned long trg_size,
> +			   unsigned long delta_size)
>  {
>  	if (max_delta_cache_size && delta_cache_size + delta_size > max_delta_cache_size)
>  		return 0;
> @@ -1397,7 +1396,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
>  	trg_entry->delta_size = delta_size;
>  	trg->depth = src->depth + 1;
>  
> -	if (delta_cacheable(src, trg, src_size, trg_size, delta_size)) {
> +	if (delta_cacheable(src_size, trg_size, delta_size)) {
>  		trg_entry->delta_data = xrealloc(delta_buf, delta_size);
>  		delta_cache_size += trg_entry->delta_size;
>  	} else

← back to recent threads