[PATCH] clean up pack index handling a bit
Especially with the new index format to come, it is more appropriate to encapsulate more into check_packed_git_idx() and assume less of the index format in struct packed_git. To that effect, the index_base is renamed to index_data with void * type so it is not used directly but other pointers initialized with it. This allows for a couple pointer cast removal, as well as providing a better generic name to grep for when adding support for new index versions or formats. And index_data is declared const too while at it. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:

committed by
Junio C Hamano

parent
ac527b0b7c
commit
4287307833
9
cache.h
9
cache.h
@ -371,10 +371,11 @@ struct pack_window {
|
||||
extern struct packed_git {
|
||||
struct packed_git *next;
|
||||
struct pack_window *windows;
|
||||
uint32_t *index_base;
|
||||
time_t mtime;
|
||||
const void *index_data;
|
||||
off_t index_size;
|
||||
off_t pack_size;
|
||||
time_t mtime;
|
||||
int index_version;
|
||||
int pack_fd;
|
||||
int pack_local;
|
||||
unsigned char sha1[20];
|
||||
@ -412,7 +413,7 @@ extern int server_supports(const char *feature);
|
||||
|
||||
extern struct packed_git *parse_pack_index(unsigned char *sha1);
|
||||
extern struct packed_git *parse_pack_index_file(const unsigned char *sha1,
|
||||
char *idx_path);
|
||||
const char *idx_path);
|
||||
|
||||
extern void prepare_packed_git(void);
|
||||
extern void reprepare_packed_git(void);
|
||||
@ -424,7 +425,7 @@ extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
|
||||
extern void pack_report(void);
|
||||
extern unsigned char* use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *);
|
||||
extern void unuse_pack(struct pack_window **);
|
||||
extern struct packed_git *add_packed_git(char *, int, int);
|
||||
extern struct packed_git *add_packed_git(const char *, int, int);
|
||||
extern uint32_t num_packed_objects(const struct packed_git *p);
|
||||
extern int nth_packed_object_sha1(const struct packed_git *, uint32_t, unsigned char*);
|
||||
extern off_t find_pack_entry_one(const unsigned char *, struct packed_git *);
|
||||
|
Reference in New Issue
Block a user