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 <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan committed
Aug 18, 2017 at 15:20 UTC
6d6a80e06893f391b4aaafa8829f1cb3a0ac23f6
3 files changed
+23
-13
packfile.c
+14
@@ -1,4 +1,5 @@
1
#include "cache.h"
2
+#include "mru.h"
3
4
char *odb_pack_name(struct strbuf *buf,
5
const unsigned char *sha1,
@@ -21,3 +22,16 @@ char *sha1_pack_index_name(const unsigned char *sha1)
22
static struct strbuf buf = STRBUF_INIT;
23
return odb_pack_name(&buf, sha1, "idx");
24
}
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
+9
@@ -24,4 +24,13 @@ extern char *sha1_pack_name(const unsigned char *sha1);
24
*/
25
extern char *sha1_pack_index_name(const unsigned char *sha1);
26
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
+
36
#endif
sha1_file.c
-13
@@ -684,19 +684,6 @@ static int has_loose_object(const unsigned char *sha1)
684
return check_and_freshen(sha1, 0);
685
}
686
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
-
687
void pack_report(void)
688
{
689
fprintf(stderr,