Re: [PATCH] Unify write_index_file functions

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

 



Geert Bosch <bosch@xxxxxxxx> writes:

> diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
> index e52332d..d4c5d2b 100644
> --- a/builtin-pack-objects.c
> +++ b/builtin-pack-objects.c
> @@ -24,9 +24,10 @@ git-pack-objects [{ -q | --progress | --all-progress }] [--max-pack-size=N] \n\
>  
>  struct object_entry {
>  	unsigned char sha1[20];
> -	uint32_t crc32;		/* crc of raw pack data for this object */
>  	off_t offset;		/* offset into the final pack file */
>  	unsigned long size;	/* uncompressed size */
> +	uint32_t crc32;		/* crc of raw pack data for this object */
> +
>  	unsigned int hash;	/* name hint hash */
>  	unsigned int depth;	/* delta depth */
>  	struct packed_git *in_pack; 	/* already in pack */

Why?  off_t offset used to be 8-byte aligned but now it is not...

> diff --git a/index-pack.c b/index-pack.c
> index 58c4a9c..ed6ff9c 100644
> --- a/index-pack.c
> +++ b/index-pack.c
> @@ -13,13 +13,14 @@ static const char index_pack_usage[] =
>  
>  struct object_entry
>  {
> +	unsigned char sha1[20];
>  	off_t offset;
>  	unsigned long size;
> -	unsigned int hdr_size;
>  	uint32_t crc32;
> +
> +	unsigned int hdr_size;
>  	enum object_type type;
>  	enum object_type real_type;
> -	unsigned char sha1[20];
>  };
>  
>  union delta_base {

Ah, you wanted to match the shape of the early part of two
structures.  Sounds error prone for people who would want to
maintain both programs in the future.

Why not make the private "struct object_entry" in each users
have an embedded structure at the beginning like this:

	struct object_entry {
        	struct idx_object_entry idx;
                unsigned int hash;
                unsigned int depth;
                ...
	}; /* in builtin-pack-objects.c */

        struct object_entry {        
        	struct idx_object_entry idx;
                unsigned int hdr_size;
                enum object_type type;
                enum object_type real_type;
	}; /* in index-pack.c */


-
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