Re: [PATCH 01/11] packed_object_info_detail(): do not return a string

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

 



On Sun, May 15, 2011 at 9:30 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Instead return enum object_name just like everybody else does.
> The caller can turn it into a string with typename() easily.
>
> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
> ---
> Âbuiltin/verify-pack.c | Â Â4 ++--
> Âcache.h        |  Â2 +-
> Âsha1_file.c      |  Â4 ++--
> Â3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c
> index b6079ae..3a919b1 100644
> --- a/builtin/verify-pack.c
> +++ b/builtin/verify-pack.c
> @@ -33,9 +33,9 @@ static void show_pack_info(struct packed_git *p, unsigned int flags)
> Â Â Â Â Â Â Â Âif (!sha1)
> Â Â Â Â Â Â Â Â Â Â Â Âdie("internal error pack-check nth-packed-object");
> Â Â Â Â Â Â Â Âoffset = nth_packed_object_offset(p, i);
> - Â Â Â Â Â Â Â type = packed_object_info_detail(p, offset, &size, &store_size,
> + Â Â Â Â Â Â Â type = typename(packed_object_info_detail(p, offset, &size, &store_size,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &delta_chain_length,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âbase_sha1);
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âbase_sha1));
> Â Â Â Â Â Â Â Âif (!stat_only)
> Â Â Â Â Â Â Â Â Â Â Â Âprintf("%s ", sha1_to_hex(sha1));
> Â Â Â Â Â Â Â Âif (!delta_chain_length) {
> diff --git a/cache.h b/cache.h
> index b1b5bb5..cdb5112 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -1020,7 +1020,7 @@ extern off_t find_pack_entry_one(const unsigned char *, struct packed_git *);
> Âextern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *);
> Âextern unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
> Âextern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
> -extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);
> +extern int packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);

In the commit message you say to return "enum object_name". Maybe
change from int to enum object_name here and below?

Also, |type| below is enum object_type not object_name.

>
> Â/* Dumb servers support */
> Âextern int update_server_info(int);
> diff --git a/sha1_file.c b/sha1_file.c
> index 064a330..4f96eb1 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -1549,7 +1549,7 @@ static int unpack_object_header(struct packed_git *p,
> Â Â Â Âreturn type;
> Â}
>
> -const char *packed_object_info_detail(struct packed_git *p,
> +int packed_object_info_detail(struct packed_git *p,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âoff_t obj_offset,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âunsigned long *size,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âunsigned long *store_size,
> @@ -1580,7 +1580,7 @@ const char *packed_object_info_detail(struct packed_git *p,
> Â Â Â Â Â Â Â Âcase OBJ_BLOB:
> Â Â Â Â Â Â Â Âcase OBJ_TAG:
> Â Â Â Â Â Â Â Â Â Â Â Âunuse_pack(&w_curs);
> - Â Â Â Â Â Â Â Â Â Â Â return typename(type);
> + Â Â Â Â Â Â Â Â Â Â Â return type;
> Â Â Â Â Â Â Â Âcase OBJ_OFS_DELTA:
> Â Â Â Â Â Â Â Â Â Â Â Âobj_offset = get_delta_base(p, &w_curs, &curpos, type, obj_offset);
> Â Â Â Â Â Â Â Â Â Â Â Âif (!obj_offset)
> --
> 1.7.5.1.365.g32b65
>
> --
> 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
>
--
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]