Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion delta.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void free_delta_index(struct delta_index *index);
*

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patrick Steinhardt wrote on the Git mailing list (how to reply to this email):

On Wed, Aug 05, 2026 at 04:14:28PM +0000, Johannes Schindelin via GitGitGadget wrote:
> diff --git a/delta.h b/delta.h
> index eb5c6d2fdb..ab0279168c 100644
> --- a/delta.h
> +++ b/delta.h
> @@ -28,7 +28,7 @@ void free_delta_index(struct delta_index *index);
>   *
>   * Given pointer must be what create_delta_index() returned, or NULL.
>   */
> -unsigned long sizeof_delta_index(struct delta_index *index);
> +size_t sizeof_delta_index(struct delta_index *index);
>  
>  /*
>   * create_delta: create a delta from given index for the given buffer

Okay. At this point in time there's still at least one caller that
assigns the result of `sizeof_delta_index()` to an `unsigned long`. But
at the end of the series all callers assign to a `size_t`.

Patrick

* Given pointer must be what create_delta_index() returned, or NULL.
*/
unsigned long sizeof_delta_index(struct delta_index *index);
size_t sizeof_delta_index(struct delta_index *index);

/*
* create_delta: create a delta from given index for the given buffer
Expand Down
8 changes: 4 additions & 4 deletions diff-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ struct unpacked_index_entry {
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patrick Steinhardt wrote on the Git mailing list (how to reply to this email):

On Thu, Jul 09, 2026 at 04:49:28PM +0000, Johannes Schindelin via GitGitGadget wrote:
> diff --git a/diff-delta.c b/diff-delta.c
> index 43c339f010..b6b65d7607 100644
> --- a/diff-delta.c
> +++ b/diff-delta.c
> @@ -125,9 +125,9 @@ struct unpacked_index_entry {
>  };
>  
>  struct delta_index {
> -	unsigned long memsize;
> +	size_t memsize;
>  	const void *src_buf;
> -	unsigned long src_size;
> +	size_t src_size;
>  	unsigned int hash_mask;
>  	struct index_entry *hash[FLEX_ARRAY];
>  };

`sizeof_delta_index` returns `index->memsize`, so we'll also have to
adapt that function's return value and its callers.

> @@ -140,7 +140,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)

I was about to complain that the input parameter here uses `unsigned
long`, too. But the next patch addresses that.

>  	struct unpacked_index_entry *entry, **hash;
>  	struct index_entry *packed_entry, **packed_hash;
>  	void *mem;
> -	unsigned long memsize;
> +	size_t memsize;
>  
>  	if (!buf || !bufsize)
>  		return NULL;

Patrick

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Johannes Schindelin wrote on the Git mailing list (how to reply to this email):

Hi Patrick,

On Wed, 5 Aug 2026, Patrick Steinhardt wrote:

> On Thu, Jul 09, 2026 at 04:49:28PM +0000, Johannes Schindelin via GitGitGadget wrote:
> > diff --git a/diff-delta.c b/diff-delta.c
> > index 43c339f010..b6b65d7607 100644
> > --- a/diff-delta.c
> > +++ b/diff-delta.c
> > @@ -125,9 +125,9 @@ struct unpacked_index_entry {
> >  };
> >  
> >  struct delta_index {
> > -	unsigned long memsize;
> > +	size_t memsize;
> >  	const void *src_buf;
> > -	unsigned long src_size;
> > +	size_t src_size;
> >  	unsigned int hash_mask;
> >  	struct index_entry *hash[FLEX_ARRAY];
> >  };
> 
> `sizeof_delta_index` returns `index->memsize`, so we'll also have to
> adapt that function's return value and its callers.

Good call! Will fix.

Ciao,
Johannes

> 
> > @@ -140,7 +140,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
> 
> I was about to complain that the input parameter here uses `unsigned
> long`, too. But the next patch addresses that.
> 
> >  	struct unpacked_index_entry *entry, **hash;
> >  	struct index_entry *packed_entry, **packed_hash;
> >  	void *mem;
> > -	unsigned long memsize;
> > +	size_t memsize;
> >  
> >  	if (!buf || !bufsize)
> >  		return NULL;
> 
> Patrick
> 


struct delta_index {
unsigned long memsize;
size_t memsize;
const void *src_buf;
unsigned long src_size;
size_t src_size;
unsigned int hash_mask;
struct index_entry *hash[FLEX_ARRAY];
};
Expand All @@ -140,7 +140,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
struct unpacked_index_entry *entry, **hash;
struct index_entry *packed_entry, **packed_hash;
void *mem;
unsigned long memsize;
size_t memsize;

if (!buf || !bufsize)
return NULL;
Expand Down Expand Up @@ -302,7 +302,7 @@ void free_delta_index(struct delta_index *index)
free(index);
}

unsigned long sizeof_delta_index(struct delta_index *index)
size_t sizeof_delta_index(struct delta_index *index)
{
if (index)
return index->memsize;
Expand Down