sha1_name.c: hide get_sha1_with_context_1() ugliness
There is no outside caller that cares about the "only-to-die" ugliness. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jul 2, 2012 at 10:19 UTC
f01cc14c3c70cfd820114505d2ddc153c28f6f89
2 files changed
+19
-18
cache.h
+1
-5
@@ -817,11 +817,7 @@ static inline int get_sha1_with_mode(const char *str, unsigned char *sha1, unsig
817
{
818
return get_sha1_with_mode_1(str, sha1, mode, 0, NULL);
819
}
820
-extern int get_sha1_with_context_1(const char *name, unsigned char *sha1, struct object_context *orc, int only_to_die, const char *prefix);
821
-static inline int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc)
822
-{
823
- return get_sha1_with_context_1(str, sha1, orc, 0, NULL);
824
-}
820
+extern int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc);
821
822
/*
823
* Try to read a SHA1 in hexadecimal format from the 40 characters
sha1_name.c
+18
-13
@@ -992,16 +992,6 @@ static void diagnose_invalid_index_path(int stage,
992
}
993
994
995
-int get_sha1_with_mode_1(const char *name, unsigned char *sha1, unsigned *mode,
996
- int only_to_die, const char *prefix)
997
-{
998
- struct object_context oc;
999
- int ret;
1000
- ret = get_sha1_with_context_1(name, sha1, &oc, only_to_die, prefix);
1001
- *mode = oc.mode;
1002
- return ret;
1003
-}
1004
-
995
static char *resolve_relative_path(const char *rel)
996
{
997
if (prefixcmp(rel, "./") && prefixcmp(rel, "../"))
@@ -1019,9 +1009,9 @@ static char *resolve_relative_path(const char *rel)
1009
rel);
1010
}
1011
1022
-int get_sha1_with_context_1(const char *name, unsigned char *sha1,
1023
- struct object_context *oc,
1024
- int only_to_die, const char *prefix)
1012
+static int get_sha1_with_context_1(const char *name, unsigned char *sha1,
1013
+ struct object_context *oc,
1014
+ int only_to_die, const char *prefix)
1015
{
1016
int ret, bracket_depth;
1017
int namelen = strlen(name);
@@ -1134,3 +1124,18 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
1124
}
1125
return ret;
1126
}
1127
+
1128
+int get_sha1_with_mode_1(const char *name, unsigned char *sha1, unsigned *mode,
1129
+ int only_to_die, const char *prefix)
1130
+{
1131
+ struct object_context oc;
1132
+ int ret;
1133
+ ret = get_sha1_with_context_1(name, sha1, &oc, only_to_die, prefix);
1134
+ *mode = oc.mode;
1135
+ return ret;
1136
+}
1137
+
1138
+int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc)
1139
+{
1140
+ return get_sha1_with_context_1(str, sha1, orc, 0, NULL);
1141
+}