[PATCH 23/24] cache.h: drop ce_match_stat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



coccinelle patch:
@@ expression ce, st, options; @@
-ce_match_stat(ce, st, options)
+ie_match_stat(&the_index, ce, st, options)

Additionally drop the define from cache.h manually.

Note that there is an empty define section in cache.h now.
The cleanup of that is done in a later patch.

Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 apply.c                | 3 ++-
 builtin/rm.c           | 2 +-
 builtin/update-index.c | 2 +-
 cache.h                | 1 -
 check-racy.c           | 4 ++--
 diff-lib.c             | 2 +-
 diff.c                 | 2 +-
 entry.c                | 3 ++-
 submodule.c            | 2 +-
 9 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/apply.c b/apply.c
index 8a61f19d03..46bc5a20b9 100644
--- a/apply.c
+++ b/apply.c
@@ -3364,7 +3364,8 @@ static int verify_index_match(const struct cache_entry *ce, struct stat *st)
 			return -1;
 		return 0;
 	}
-	return ce_match_stat(ce, st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE);
+	return ie_match_stat(&the_index, ce, st,
+			     CE_MATCH_IGNORE_VALID | CE_MATCH_IGNORE_SKIP_WORKTREE);
 }
 
 #define SUBMODULE_PATCH_WITHOUT_INDEX 1
diff --git a/builtin/rm.c b/builtin/rm.c
index f479100298..51b64f2bae 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -163,7 +163,7 @@ static int check_local_mod(struct object_id *head, int index_only)
 		 * Is the index different from the file in the work tree?
 		 * If it's a submodule, is its work tree modified?
 		 */
-		if (ce_match_stat(ce, &st, 0) ||
+		if (ie_match_stat(&the_index, ce, &st, 0) ||
 		    (S_ISGITLINK(ce->ce_mode) &&
 		     bad_to_remove_submodule(ce->name,
 				SUBMODULE_REMOVAL_DIE_ON_ERROR |
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 9cbd346f95..042f4c94cf 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -268,7 +268,7 @@ static int add_one_path(const struct cache_entry *old, const char *path, int len
 	struct cache_entry *ce;
 
 	/* Was the old index entry already up-to-date? */
-	if (old && !ce_stage(old) && !ce_match_stat(old, st, 0))
+	if (old && !ce_stage(old) && !ie_match_stat(&the_index, old, st, 0))
 		return 0;
 
 	size = cache_entry_size(len);
diff --git a/cache.h b/cache.h
index c34fc4fd40..f2a45eda9a 100644
--- a/cache.h
+++ b/cache.h
@@ -354,7 +354,6 @@ extern void free_name_hash(struct index_state *istate);
 
 
 #ifndef NO_THE_INDEX_COMPATIBILITY_MACROS
-#define ce_match_stat(ce, st, options) ie_match_stat(&the_index, (ce), (st), (options))
 #endif
 
 enum object_type {
diff --git a/check-racy.c b/check-racy.c
index 6599ae84cf..485d7ab8f8 100644
--- a/check-racy.c
+++ b/check-racy.c
@@ -16,9 +16,9 @@ int main(int ac, char **av)
 			continue;
 		}
 
-		if (ce_match_stat(ce, &st, 0))
+		if (ie_match_stat(&the_index, ce, &st, 0))
 			dirty++;
-		else if (ce_match_stat(ce, &st, CE_MATCH_RACY_IS_DIRTY))
+		else if (ie_match_stat(&the_index, ce, &st, CE_MATCH_RACY_IS_DIRTY))
 			racy++;
 		else
 			clean++;
diff --git a/diff-lib.c b/diff-lib.c
index de59ec0459..4ca3ce9c90 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -69,7 +69,7 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
 				     struct stat *st, unsigned ce_option,
 				     unsigned *dirty_submodule)
 {
-	int changed = ce_match_stat(ce, st, ce_option);
+	int changed = ie_match_stat(&the_index, ce, st, ce_option);
 	if (S_ISGITLINK(ce->ce_mode)) {
 		unsigned orig_flags = diffopt->flags;
 		if (!DIFF_OPT_TST(diffopt, OVERRIDE_SUBMODULE_CONFIG))
diff --git a/diff.c b/diff.c
index f2ee40fe21..bd1478f6c9 100644
--- a/diff.c
+++ b/diff.c
@@ -2782,7 +2782,7 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
 	 * If ce matches the file in the work tree, we can reuse it.
 	 */
 	if (ce_uptodate(ce) ||
-	    (!lstat(name, &st) && !ce_match_stat(ce, &st, 0)))
+	    (!lstat(name, &st) && !ie_match_stat(&the_index, ce, &st, 0)))
 		return 1;
 
 	return 0;
diff --git a/entry.c b/entry.c
index d2b512da90..d3a34c9cc4 100644
--- a/entry.c
+++ b/entry.c
@@ -266,7 +266,8 @@ int checkout_entry(struct cache_entry *ce,
 
 	if (!check_path(path.buf, path.len, &st, state->base_dir_len)) {
 		const struct submodule *sub;
-		unsigned changed = ce_match_stat(ce, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE);
+		unsigned changed = ie_match_stat(&the_index, ce, &st,
+						 CE_MATCH_IGNORE_VALID | CE_MATCH_IGNORE_SKIP_WORKTREE);
 		/*
 		 * Needs to be checked before !changed returns early,
 		 * as the possibly empty directory was not changed
diff --git a/submodule.c b/submodule.c
index 6587bc0d84..43997f237e 100644
--- a/submodule.c
+++ b/submodule.c
@@ -191,7 +191,7 @@ void gitmodules_config(void)
 		} else if (pos < the_index.cache_nr) {
 			struct stat st;
 			if (lstat(".gitmodules", &st) == 0 &&
-			    ce_match_stat(the_index.cache[pos], &st, 0) & DATA_CHANGED)
+			    ie_match_stat(&the_index, the_index.cache[pos], &st, 0) & DATA_CHANGED)
 				gitmodules_is_modified = 1;
 		}
 
-- 
2.13.0.rc1.39.ga6db8bfa24




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]