]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sha1_name.c: hide get_sha1_with_context_1() ugliness
authorJunio C Hamano <gitster@pobox.com>
Mon, 2 Jul 2012 17:19:35 +0000 (10:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Jul 2012 18:22:57 +0000 (11:22 -0700)
There is no outside caller that cares about the "only-to-die" ugliness.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
sha1_name.c

diff --git a/cache.h b/cache.h
index 10afd71d435920a3cc2152208a06058791ea7a04..9ee470ce12393ec6a4ce4e4ecdb7f2a8b9d895ba 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -817,11 +817,7 @@ static inline int get_sha1_with_mode(const char *str, unsigned char *sha1, unsig
 {
        return get_sha1_with_mode_1(str, sha1, mode, 0, NULL);
 }
-extern int get_sha1_with_context_1(const char *name, unsigned char *sha1, struct object_context *orc, int only_to_die, const char *prefix);
-static inline int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc)
-{
-       return get_sha1_with_context_1(str, sha1, orc, 0, NULL);
-}
+extern int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc);
 
 /*
  * Try to read a SHA1 in hexadecimal format from the 40 characters
index 5b0c845d856cd8f78a426df944aa9d6fb64a365f..10932bfe1d3f6bcc5ebe08283daf0dcde008b1b7 100644 (file)
@@ -992,16 +992,6 @@ static void diagnose_invalid_index_path(int stage,
 }
 
 
-int get_sha1_with_mode_1(const char *name, unsigned char *sha1, unsigned *mode,
-                        int only_to_die, const char *prefix)
-{
-       struct object_context oc;
-       int ret;
-       ret = get_sha1_with_context_1(name, sha1, &oc, only_to_die, prefix);
-       *mode = oc.mode;
-       return ret;
-}
-
 static char *resolve_relative_path(const char *rel)
 {
        if (prefixcmp(rel, "./") && prefixcmp(rel, "../"))
@@ -1019,9 +1009,9 @@ static char *resolve_relative_path(const char *rel)
                           rel);
 }
 
-int get_sha1_with_context_1(const char *name, unsigned char *sha1,
-                           struct object_context *oc,
-                           int only_to_die, const char *prefix)
+static int get_sha1_with_context_1(const char *name, unsigned char *sha1,
+                                  struct object_context *oc,
+                                  int only_to_die, const char *prefix)
 {
        int ret, bracket_depth;
        int namelen = strlen(name);
@@ -1134,3 +1124,18 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
        }
        return ret;
 }
+
+int get_sha1_with_mode_1(const char *name, unsigned char *sha1, unsigned *mode,
+                        int only_to_die, const char *prefix)
+{
+       struct object_context oc;
+       int ret;
+       ret = get_sha1_with_context_1(name, sha1, &oc, only_to_die, prefix);
+       *mode = oc.mode;
+       return ret;
+}
+
+int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc)
+{
+       return get_sha1_with_context_1(str, sha1, orc, 0, NULL);
+}