@@ -154,7 +154,9 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
break;
case 0:
- exp_type_id = type_from_string(exp_type);
+ exp_type_id = type_from_string_gently(exp_type, strlen(exp_type));
+ if (exp_type_id < 0)
+ die(_("invalid object type \"%s\""), exp_type);
if (exp_type_id == OBJ_BLOB) {
struct object_id blob_oid;
if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {
@@ -49,15 +49,6 @@ enum object_type type_from_string_gently(const char *str, size_t len)
return -1;
}
-enum object_type type_from_string(const char *str)
-{
- size_t len = strlen(str);
- enum object_type ret = type_from_string_gently(str, len);
- if (ret < 0)
- die(_("invalid object type \"%s\""), str);
- return ret;
-}
-
/*
* Return a numerical hash value between 0 and n-1 for the object with
* the specified sha1. n must be a power of 2. Please note that the
@@ -94,7 +94,6 @@ struct object {
const char *type_name(unsigned int type);
enum object_type type_from_string_gently(const char *str, size_t len);
-enum object_type type_from_string(const char *str);
/*
* Return the current number of buckets in the object hashmap.
In commits leading up to this one various errors have been improved and bugs fixed by moving various callers to type_from_string_gently(). Now that there's no caller left of type_from_string() except cat-file.c, let's move this function over to it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/cat-file.c | 4 +++- object.c | 9 --------- object.h | 1 - 3 files changed, 3 insertions(+), 11 deletions(-)