Skip to content

Commit 6d6a80e

Browse files
jonathantanmygitster
authored andcommitted
pack: move static state variables
sha1_file.c declares some static variables that store packfile-related state. Move them to packfile.c. They are temporarily made global, but subsequent commits will restore their scope back to static. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4f39cd8 commit 6d6a80e

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

packfile.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "cache.h"
2+
#include "mru.h"
23

34
char *odb_pack_name(struct strbuf *buf,
45
const unsigned char *sha1,
@@ -21,3 +22,16 @@ char *sha1_pack_index_name(const unsigned char *sha1)
2122
static struct strbuf buf = STRBUF_INIT;
2223
return odb_pack_name(&buf, sha1, "idx");
2324
}
25+
26+
unsigned int pack_used_ctr;
27+
unsigned int pack_mmap_calls;
28+
unsigned int peak_pack_open_windows;
29+
unsigned int pack_open_windows;
30+
unsigned int pack_open_fds;
31+
unsigned int pack_max_fds;
32+
size_t peak_pack_mapped;
33+
size_t pack_mapped;
34+
struct packed_git *packed_git;
35+
36+
static struct mru packed_git_mru_storage;
37+
struct mru *packed_git_mru = &packed_git_mru_storage;

packfile.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,13 @@ extern char *sha1_pack_name(const unsigned char *sha1);
2424
*/
2525
extern char *sha1_pack_index_name(const unsigned char *sha1);
2626

27+
extern unsigned int pack_used_ctr;
28+
extern unsigned int pack_mmap_calls;
29+
extern unsigned int peak_pack_open_windows;
30+
extern unsigned int pack_open_windows;
31+
extern unsigned int pack_open_fds;
32+
extern unsigned int pack_max_fds;
33+
extern size_t peak_pack_mapped;
34+
extern size_t pack_mapped;
35+
2736
#endif

sha1_file.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -684,19 +684,6 @@ static int has_loose_object(const unsigned char *sha1)
684684
return check_and_freshen(sha1, 0);
685685
}
686686

687-
static unsigned int pack_used_ctr;
688-
static unsigned int pack_mmap_calls;
689-
static unsigned int peak_pack_open_windows;
690-
static unsigned int pack_open_windows;
691-
static unsigned int pack_open_fds;
692-
static unsigned int pack_max_fds;
693-
static size_t peak_pack_mapped;
694-
static size_t pack_mapped;
695-
struct packed_git *packed_git;
696-
697-
static struct mru packed_git_mru_storage;
698-
struct mru *packed_git_mru = &packed_git_mru_storage;
699-
700687
void pack_report(void)
701688
{
702689
fprintf(stderr,

0 commit comments

Comments
 (0)