summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4280cde)
raw | patch | inline | side by side (parent: 4280cde)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 2 Apr 2007 01:14:06 +0000 (18:14 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 23 Apr 2007 05:53:54 +0000 (22:53 -0700) |
This defines a index_state structure and moves index-related
global variables into it. Currently there is one instance of
it, the_index, and everybody accesses it, so there is no code
change.
Signed-off-by: Junio C Hamano <junkio@cox.net>
global variables into it. Currently there is one instance of
it, the_index, and everybody accesses it, so there is no code
change.
Signed-off-by: Junio C Hamano <junkio@cox.net>
cache.h | patch | blob | history | |
read-cache.c | patch | blob | history |
index 89aaf0022d95dfe8ffda4031021e4d059998d28c..4841c9a16187f12e9815b81fd8283cd8fd7ead1a 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -143,9 +143,22 @@ static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned in
#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
-extern struct cache_entry **active_cache;
-extern unsigned int active_nr, active_alloc, active_cache_changed;
-extern struct cache_tree *active_cache_tree;
+struct index_state {
+ struct cache_entry **cache;
+ unsigned int cache_nr, cache_alloc, cache_changed;
+ struct cache_tree *cache_tree;
+ time_t timestamp;
+ void *mmap;
+ size_t mmap_size;
+};
+
+extern struct index_state the_index;
+
+#define active_cache (the_index.cache)
+#define active_nr (the_index.cache_nr)
+#define active_alloc (the_index.cache_alloc)
+#define active_cache_changed (the_index.cache_changed)
+#define active_cache_tree (the_index.cache_tree)
enum object_type {
OBJ_BAD = -1,
diff --git a/read-cache.c b/read-cache.c
index d2f332a6222cc3543bde8fa661c54c5c904cf561..9b4385ea5cfd23ac07b460557cf296650983794d 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
#define CACHE_EXT(s) ( (s[0]<<24)|(s[1]<<16)|(s[2]<<8)|(s[3]) )
#define CACHE_EXT_TREE 0x54524545 /* "TREE" */
-struct cache_entry **active_cache;
-static time_t index_file_timestamp;
-unsigned int active_nr, active_alloc, active_cache_changed;
-
-struct cache_tree *active_cache_tree;
-
-static void *cache_mmap;
-static size_t cache_mmap_size;
+struct index_state the_index;
+#define index_file_timestamp (the_index.timestamp)
+#define cache_mmap (the_index.mmap)
+#define cache_mmap_size (the_index.mmap_size)
/*
* This only updates the "non-critical" parts of the directory