[PATCH] rerere: remove duplicated functions

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

 



Both rerere.c and builtin-rerere.c define the static functions
rr_path() and has_resolution() the exact same way.  To eliminate this
code duplication this patch turns the functions in rerere.c
non-static, and makes builtin-rerere.c use them.

Signed-off-by: SZEDER Gábor <szeder@xxxxxxxxxx>
---
 builtin-rerere.c |   11 -----------
 rerere.c         |    4 ++--
 rerere.h         |    2 ++
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/builtin-rerere.c b/builtin-rerere.c
index bd8fc77..b175334 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -13,23 +13,12 @@ static const char git_rerere_usage[] =
 static int cutoff_noresolve = 15;
 static int cutoff_resolve = 60;
 
-static const char *rr_path(const char *name, const char *file)
-{
-	return git_path("rr-cache/%s/%s", name, file);
-}
-
 static time_t rerere_created_at(const char *name)
 {
 	struct stat st;
 	return stat(rr_path(name, "preimage"), &st) ? (time_t) 0 : st.st_mtime;
 }
 
-static int has_resolution(const char *name)
-{
-	struct stat st;
-	return !stat(rr_path(name, "postimage"), &st);
-}
-
 static void unlink_rr_item(const char *name)
 {
 	unlink(rr_path(name, "thisimage"));
diff --git a/rerere.c b/rerere.c
index 3518207..ac89b80 100644
--- a/rerere.c
+++ b/rerere.c
@@ -12,12 +12,12 @@ static int rerere_autoupdate;
 
 static char *merge_rr_path;
 
-static const char *rr_path(const char *name, const char *file)
+const char *rr_path(const char *name, const char *file)
 {
 	return git_path("rr-cache/%s/%s", name, file);
 }
 
-static int has_resolution(const char *name)
+int has_resolution(const char *name)
 {
 	struct stat st;
 	return !stat(rr_path(name, "postimage"), &st);
diff --git a/rerere.h b/rerere.h
index f9b0386..45b5087 100644
--- a/rerere.h
+++ b/rerere.h
@@ -5,5 +5,7 @@
 
 extern int setup_rerere(struct string_list *);
 extern int rerere(void);
+extern const char *rr_path(const char *name, const char *file);
+extern int has_resolution(const char *name);
 
 #endif
-- 
1.6.2.rc0.111.g246ed

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]

  Powered by Linux