packed_object_info_detail(): do not return a string
Instead return an integer that can be given to typename() if the caller wants a string, just like everybody else does. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
May 12, 2011 at 16:50 UTC
b9a62cbeb91e52aea8fc427a84e72f475dfe60cf
3 files changed
+5
-5
builtin/verify-pack.c
+2
-2
@@ -33,9 +33,9 @@ static void show_pack_info(struct packed_git *p, unsigned int flags)
33
if (!sha1)
34
die("internal error pack-check nth-packed-object");
35
offset = nth_packed_object_offset(p, i);
36
- type = packed_object_info_detail(p, offset, &size, &store_size,
36
+ type = typename(packed_object_info_detail(p, offset, &size, &store_size,
37
&delta_chain_length,
38
- base_sha1);
38
+ base_sha1));
39
if (!stat_only)
40
printf("%s ", sha1_to_hex(sha1));
41
if (!delta_chain_length) {
cache.h
+1
-1
@@ -1020,7 +1020,7 @@ extern off_t find_pack_entry_one(const unsigned char *, struct packed_git *);
1020
extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *);
1021
extern unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
1022
extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
1023
-extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);
1023
+extern int packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);
1024
1025
/* Dumb servers support */
1026
extern int update_server_info(int);
sha1_file.c
+2
-2
@@ -1549,7 +1549,7 @@ static int unpack_object_header(struct packed_git *p,
1549
return type;
1550
}
1551
1552
-const char *packed_object_info_detail(struct packed_git *p,
1552
+int packed_object_info_detail(struct packed_git *p,
1553
off_t obj_offset,
1554
unsigned long *size,
1555
unsigned long *store_size,
@@ -1580,7 +1580,7 @@ const char *packed_object_info_detail(struct packed_git *p,
1580
case OBJ_BLOB:
1581
case OBJ_TAG:
1582
unuse_pack(&w_curs);
1583
- return typename(type);
1583
+ return type;
1584
case OBJ_OFS_DELTA:
1585
obj_offset = get_delta_base(p, &w_curs, &curpos, type, obj_offset);
1586
if (!obj_offset)