]> git.ipfire.org Git - thirdparty/git.git/commitdiff
object: rename function 'typename' to 'type_name'
authorBrandon Williams <bmwill@google.com>
Wed, 14 Feb 2018 18:59:24 +0000 (10:59 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Feb 2018 21:10:05 +0000 (13:10 -0800)
Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
32 files changed:
builtin/cat-file.c
builtin/diff-tree.c
builtin/fast-export.c
builtin/fsck.c
builtin/grep.c
builtin/index-pack.c
builtin/merge.c
builtin/mktree.c
builtin/prune.c
builtin/replace.c
builtin/tag.c
builtin/unpack-objects.c
builtin/verify-commit.c
bulk-checkin.c
commit.c
contrib/examples/builtin-fetch--tool.c
fast-import.c
fsck.c
http-push.c
log-tree.c
object.c
object.h
pack-check.c
packfile.c
reachable.c
ref-filter.c
sequencer.c
sha1_file.c
sha1_name.c
submodule.c
tag.c
walker.c

index d06c66c77ebda439e3143e3054a744d0b1462486..c6b3b1bfb2bd3941e36f18af9dbb586842c45e2e 100644 (file)
@@ -229,7 +229,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
                if (data->mark_query)
                        data->info.typep = &data->type;
                else
-                       strbuf_addstr(sb, typename(data->type));
+                       strbuf_addstr(sb, type_name(data->type));
        } else if (is_atom("objectsize", atom, len)) {
                if (data->mark_query)
                        data->info.sizep = &data->size;
index b775a756470ddc365907fae53dcc949bcaae7ca5..473615117e0adbb301e6ddc0ab000accc513a9ee 100644 (file)
@@ -76,7 +76,7 @@ static int diff_tree_stdin(char *line)
        if (obj->type == OBJ_TREE)
                return stdin_diff_trees((struct tree *)obj, p);
        error("Object %s is a %s, not a commit or tree",
-             oid_to_hex(&oid), typename(obj->type));
+             oid_to_hex(&oid), type_name(obj->type));
        return -1;
 }
 
index 796d0cd66c7750a20613dea77cd75b1b8e7665a4..27b2cc138e67c013adbee3cbe152ca48c3d82ff5 100644 (file)
@@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid)
                buf = read_sha1_file(oid->hash, &type, &size);
                if (!buf)
                        die ("Could not read blob %s", oid_to_hex(oid));
-               if (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)
+               if (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0)
                        die("sha1 mismatch in blob %s", oid_to_hex(oid));
                object = parse_object_buffer(oid, type, size, buf, &eaten);
        }
@@ -757,7 +757,7 @@ static void handle_tag(const char *name, struct tag *tag)
                        if (tagged->type != OBJ_COMMIT) {
                                die ("Tag %s tags unexported %s!",
                                     oid_to_hex(&tag->object.oid),
-                                    typename(tagged->type));
+                                    type_name(tagged->type));
                        }
                        p = (struct commit *)tagged;
                        for (;;) {
@@ -839,7 +839,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
                if (!commit) {
                        warning("%s: Unexpected object of type %s, skipping.",
                                e->name,
-                               typename(e->item->type));
+                               type_name(e->item->type));
                        continue;
                }
 
@@ -851,7 +851,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
                        continue;
                default: /* OBJ_TAG (nested tags) is already handled */
                        warning("Tag points to object of unexpected type %s, skipping.",
-                               typename(commit->object.type));
+                               type_name(commit->object.type));
                        continue;
                }
 
index 04846d46f91d6cde14d379da8e0e3dd458c08dc5..246237e815adfeb575cf4b7e216c662993bf19b0 100644 (file)
@@ -70,7 +70,7 @@ static const char *printable_type(struct object *obj)
                        object_as_type(obj, type, 0);
        }
 
-       ret = typename(obj->type);
+       ret = type_name(obj->type);
        if (!ret)
                ret = "unknown";
 
@@ -137,7 +137,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt
                printf("broken link from %7s %s\n",
                           printable_type(parent), describe_object(parent));
                printf("broken link from %7s %s\n",
-                          (type == OBJ_ANY ? "unknown" : typename(type)), "unknown");
+                          (type == OBJ_ANY ? "unknown" : type_name(type)), "unknown");
                errors_found |= ERROR_REACHABLE;
                return 1;
        }
index 3ca4ac80d8c7014e7e9aba228f542113a5103b48..eb12070959083ca4154ef7e6d9dff38a9f144c4e 100644 (file)
@@ -627,7 +627,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
                free(data);
                return hit;
        }
-       die(_("unable to grep from object of type %s"), typename(obj->type));
+       die(_("unable to grep from object of type %s"), type_name(obj->type));
 }
 
 static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
index 4c51aec81f374d52e7c6a1afa73ab9dea3cf40b8..8b87090e2342510905db7429d1b9e49b45ffe520 100644 (file)
@@ -228,7 +228,7 @@ static unsigned check_object(struct object *obj)
                if (type != obj->type)
                        die(_("object %s: expected type %s, found %s"),
                            oid_to_hex(&obj->oid),
-                           typename(obj->type), typename(type));
+                           type_name(obj->type), type_name(type));
                obj->flags |= FLAG_CHECKED;
                return 1;
        }
@@ -448,7 +448,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
        int hdrlen;
 
        if (!is_delta_type(type)) {
-               hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
+               hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), size) + 1;
                git_SHA1_Init(&c);
                git_SHA1_Update(&c, hdr, hdrlen);
        } else
@@ -849,7 +849,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
                        obj = parse_object_buffer(oid, type, size, buf,
                                                  &eaten);
                        if (!obj)
-                               die(_("invalid %s"), typename(type));
+                               die(_("invalid %s"), type_name(type));
                        if (do_fsck_object &&
                            fsck_object(obj, buf, size, &fsck_options))
                                die(_("Error in object"));
@@ -959,7 +959,7 @@ static void resolve_delta(struct object_entry *delta_obj,
        if (!result->data)
                bad_object(delta_obj->idx.offset, _("failed to apply delta"));
        hash_sha1_file(result->data, result->size,
-                      typename(delta_obj->real_type),
+                      type_name(delta_obj->real_type),
                       delta_obj->idx.oid.hash);
        sha1_object(result->data, NULL, result->size, delta_obj->real_type,
                    &delta_obj->idx.oid);
@@ -1379,7 +1379,7 @@ static void fix_unresolved_deltas(struct sha1file *f)
                        continue;
 
                if (check_sha1_signature(d->sha1, base_obj->data,
-                               base_obj->size, typename(type)))
+                               base_obj->size, type_name(type)))
                        die(_("local object %s is corrupt"), sha1_to_hex(d->sha1));
                base_obj->obj = append_obj_to_pack(f, d->sha1,
                                        base_obj->data, base_obj->size, type);
@@ -1588,7 +1588,7 @@ static void show_pack_info(int stat_only)
                        continue;
                printf("%s %-6s %lu %lu %"PRIuMAX,
                       oid_to_hex(&obj->idx.oid),
-                      typename(obj->real_type), obj->size,
+                      type_name(obj->real_type), obj->size,
                       (unsigned long)(obj[1].idx.offset - obj->idx.offset),
                       (uintmax_t)obj->idx.offset);
                if (is_delta_type(obj->type)) {
index 30264cfd7c1720aee814699eb3ca057e292b082d..9dec140960a61cf7c75117a5318aaf9933718943 100644 (file)
@@ -520,7 +520,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
                if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
                        strbuf_addf(msg, "%s\t\t%s '%s'\n",
                                    oid_to_hex(&desc->obj->oid),
-                                   typename(desc->obj->type),
+                                   type_name(desc->obj->type),
                                    remote);
                        goto cleanup;
                }
index da0fd8cd706659a8784da8112cd1b3acd306375f..b7b1cb51f407500c65eea10c5f4f9b89e3673481 100644 (file)
@@ -112,7 +112,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
        mode_type = object_type(mode);
        if (mode_type != type_from_string(ptr)) {
                die("entry '%s' object type (%s) doesn't match mode type (%s)",
-                       path, ptr, typename(mode_type));
+                       path, ptr, type_name(mode_type));
        }
 
        /* Check the type of object identified by sha1 */
@@ -131,7 +131,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
                         * because the new tree entry will never be correct.
                         */
                        die("entry '%s' object %s is a %s but specified type was (%s)",
-                               path, sha1_to_hex(sha1), typename(obj_type), typename(mode_type));
+                               path, sha1_to_hex(sha1), type_name(obj_type), type_name(mode_type));
                }
        }
 
index d2fdae680a1ebe75d55d4fb66a3bdd0b54829666..c175f154ea58c7ca45954034d5af35cfa9e5a576 100644 (file)
@@ -52,7 +52,7 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
        if (show_only || verbose) {
                enum object_type type = sha1_object_info(oid->hash, NULL);
                printf("%s %s\n", oid_to_hex(oid),
-                      (type > 0) ? typename(type) : "unknown");
+                      (type > 0) ? type_name(type) : "unknown");
        }
        if (!show_only)
                unlink_or_warn(fullpath);
index 10078ae37136f154486d8163b6b905ad163c7047..42cf4f62a43f21f0ffafb5460a71fa2c661f988d 100644 (file)
@@ -56,8 +56,8 @@ static int show_reference(const char *refname, const struct object_id *oid,
                        obj_type = sha1_object_info(object.hash, NULL);
                        repl_type = sha1_object_info(oid->hash, NULL);
 
-                       printf("%s (%s) -> %s (%s)\n", refname, typename(obj_type),
-                              oid_to_hex(oid), typename(repl_type));
+                       printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
+                              oid_to_hex(oid), type_name(repl_type));
                }
        }
 
@@ -168,8 +168,8 @@ static int replace_object_oid(const char *object_ref,
                die("Objects must be of the same type.\n"
                    "'%s' points to a replaced object of type '%s'\n"
                    "while '%s' points to a replacement object of type '%s'.",
-                   object_ref, typename(obj_type),
-                   replace_ref, typename(repl_type));
+                   object_ref, type_name(obj_type),
+                   replace_ref, type_name(repl_type));
 
        check_ref_valid(object, &prev, &ref, force);
 
@@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,
        argv_array_push(&cmd.args, "--no-replace-objects");
        argv_array_push(&cmd.args, "cat-file");
        if (raw)
-               argv_array_push(&cmd.args, typename(type));
+               argv_array_push(&cmd.args, type_name(type));
        else
                argv_array_push(&cmd.args, "-p");
        argv_array_push(&cmd.args, oid_to_hex(oid));
@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
        struct tag *tag;
        int i;
 
-       hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
+       hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);
        tag = lookup_tag(&tag_oid);
        if (!tag)
                die(_("bad mergetag in commit '%s'"), ref);
index a7e6a5b0f234a95fb45a71d7e9aa7f0baa2b47f8..7e0881fba94f6cf399e355320707d80987bade09 100644 (file)
@@ -220,7 +220,7 @@ static void create_tag(const struct object_id *object, const char *tag,
                    "tag %s\n"
                    "tagger %s\n\n",
                    oid_to_hex(object),
-                   typename(type),
+                   type_name(type),
                    tag,
                    git_committer_info(IDENT_STRICT));
 
index 62ea264c46783374d0f1968c19ea7581498a1f87..e9307907018a028e526ff39a0432e840a8e7be6b 100644 (file)
@@ -172,7 +172,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
 {
        struct object_id oid;
 
-       if (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0)
+       if (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)
                die("failed to write object %s", oid_to_hex(&obj->oid));
        obj->flags |= FLAG_WRITTEN;
 }
@@ -237,14 +237,14 @@ static void write_object(unsigned nr, enum object_type type,
                         void *buf, unsigned long size)
 {
        if (!strict) {
-               if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
+               if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
                        die("failed to write object");
                added_object(nr, type, buf, size);
                free(buf);
                obj_list[nr].obj = NULL;
        } else if (type == OBJ_BLOB) {
                struct blob *blob;
-               if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
+               if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
                        die("failed to write object");
                added_object(nr, type, buf, size);
                free(buf);
@@ -258,12 +258,12 @@ static void write_object(unsigned nr, enum object_type type,
        } else {
                struct object *obj;
                int eaten;
-               hash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);
+               hash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);
                added_object(nr, type, buf, size);
                obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
                                          &eaten);
                if (!obj)
-                       die("invalid %s", typename(type));
+                       die("invalid %s", type_name(type));
                add_object_buffer(obj, buf, size);
                obj->flags |= FLAG_OPEN;
                obj_list[nr].obj = obj;
index ba38ac9b1518884693e2c89ec19cc9e00fce9fa3..05315ea7c966d3ed5b91e4cbd77eaa9943af253d 100644 (file)
@@ -49,7 +49,7 @@ static int verify_commit(const char *name, unsigned flags)
                return error("%s: unable to read file.", name);
        if (type != OBJ_COMMIT)
                return error("%s: cannot verify a non-commit object of type %s.",
-                               name, typename(type));
+                               name, type_name(type));
 
        ret = run_gpg_verify(&oid, buf, size, flags);
 
index 3310fd210a151545076169b45f5555b52acbbf9d..bb788494fdab32cbbfb0f022c8826cc5c24a459f 100644 (file)
@@ -203,7 +203,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
                return error("cannot find the current offset");
 
        header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
-                              typename(type), (uintmax_t)size) + 1;
+                              type_name(type), (uintmax_t)size) + 1;
        git_SHA1_Init(&ctx);
        git_SHA1_Update(&ctx, obuf, header_len);
 
index ff51c9f34a975fdd3320f8c185f6e3c8b5176e81..cd9ace105dc150da877c55f9e8f5f6da9e1efb7b 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -274,7 +274,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
                            oid_to_hex(&commit->object.oid));
                if (type != OBJ_COMMIT)
                        die("expected commit for %s, got %s",
-                           oid_to_hex(&commit->object.oid), typename(type));
+                           oid_to_hex(&commit->object.oid), type_name(type));
                if (sizep)
                        *sizep = size;
        }
index a3eb19de0418cbb3bccf54ba7e97e331f079e32e..22648c3afb7b8fed6d05235dc33f0482aef672fa 100644 (file)
@@ -15,7 +15,7 @@ static char *get_stdin(void)
 
 static void show_new(enum object_type type, unsigned char *sha1_new)
 {
-       fprintf(stderr, "  %s: %s\n", typename(type),
+       fprintf(stderr, "  %s: %s\n", type_name(type),
                find_unique_abbrev(sha1_new, DEFAULT_ABBREV));
 }
 
index b70ac025e0428b239c9cb8b8a70dda70c0cc1007..92b89d191a1b91036e1a6e3dea316bc07cf0abcb 100644 (file)
@@ -1096,7 +1096,7 @@ static int store_object(
        git_zstream s;
 
        hdrlen = xsnprintf((char *)hdr, sizeof(hdr), "%s %lu",
-                          typename(type), (unsigned long)dat->len) + 1;
+                          type_name(type), (unsigned long)dat->len) + 1;
        git_SHA1_Init(&c);
        git_SHA1_Update(&c, hdr, hdrlen);
        git_SHA1_Update(&c, dat->buf, dat->len);
@@ -2421,7 +2421,7 @@ static void file_change_m(const char *p, struct branch *b)
                else if (oe) {
                        if (oe->type != OBJ_COMMIT)
                                die("Not a commit (actually a %s): %s",
-                                       typename(oe->type), command_buf.buf);
+                                       type_name(oe->type), command_buf.buf);
                }
                /*
                 * Accept the sha1 without checking; it expected to be in
@@ -2448,7 +2448,7 @@ static void file_change_m(const char *p, struct branch *b)
                                        command_buf.buf);
                if (type != expected)
                        die("Not a %s (actually a %s): %s",
-                               typename(expected), typename(type),
+                               type_name(expected), type_name(type),
                                command_buf.buf);
        }
 
@@ -2599,14 +2599,14 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
        } else if (oe) {
                if (oe->type != OBJ_BLOB)
                        die("Not a blob (actually a %s): %s",
-                               typename(oe->type), command_buf.buf);
+                               type_name(oe->type), command_buf.buf);
        } else if (!is_null_oid(&oid)) {
                enum object_type type = sha1_object_info(oid.hash, NULL);
                if (type < 0)
                        die("Blob not found: %s", command_buf.buf);
                if (type != OBJ_BLOB)
                        die("Not a blob (actually a %s): %s",
-                           typename(type), command_buf.buf);
+                           type_name(type), command_buf.buf);
        }
 
        construct_path_with_fanout(oid_to_hex(&commit_oid), *old_fanout, path);
@@ -2914,7 +2914,7 @@ static void parse_new_tag(const char *arg)
                    "object %s\n"
                    "type %s\n"
                    "tag %s\n",
-                   oid_to_hex(&oid), typename(type), t->name);
+                   oid_to_hex(&oid), type_name(type), t->name);
        if (tagger)
                strbuf_addf(&new_data,
                            "tagger %s\n", tagger);
@@ -2985,10 +2985,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
                die("Can't read object %s", oid_to_hex(oid));
        if (type != OBJ_BLOB)
                die("Object %s is a %s but a blob was expected.",
-                   oid_to_hex(oid), typename(type));
+                   oid_to_hex(oid), type_name(type));
        strbuf_reset(&line);
        strbuf_addf(&line, "%s %s %lu\n", oid_to_hex(oid),
-                                               typename(type), size);
+                                               type_name(type), size);
        cat_blob_write(line.buf, line.len);
        strbuf_release(&line);
        cat_blob_write(buf, size);
diff --git a/fsck.c b/fsck.c
index 032699e9ac2622c7d089523a456db0fa83310e14..5c8c12dde381912eccf59bbf3ed8c774344809b8 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -821,7 +821,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
                        ret = report(options, &tag->object,
                                FSCK_MSG_TAG_OBJECT_NOT_TAG,
                                "expected tag got %s",
-                           typename(type));
+                           type_name(type));
                        goto done;
                }
        }
index 14435ab65d1bbe3fc73be6a6d774b6ab6ffc8360..8814aa12e9562f49616ccce90b29595bbdacf1f4 100644 (file)
@@ -362,7 +362,7 @@ static void start_put(struct transfer_request *request)
        git_zstream stream;
 
        unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
-       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
 
        /* Set it up */
        git_deflate_init(&stream, zlib_compression_level);
index fca29d4799da27164394a8c59da067a0522241fe..2eeddbeb351a31015e72980867a2de46c63bfcbd 100644 (file)
@@ -499,7 +499,7 @@ static void show_one_mergetag(struct commit *commit,
        int status, nth;
        size_t payload_size, gpg_message_offset;
 
-       hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
+       hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);
        tag = lookup_tag(&oid);
        if (!tag)
                return; /* error message already given */
index 0afdfd19b784a541ad6d7237add2fbb1c9ec91ab..0db33b26bae383a03dd56c3f2352e0301105d75e 100644 (file)
--- a/object.c
+++ b/object.c
@@ -26,7 +26,7 @@ static const char *object_type_strings[] = {
        "tag",          /* OBJ_TAG = 4 */
 };
 
-const char *typename(unsigned int type)
+const char *type_name(unsigned int type)
 {
        if (type >= ARRAY_SIZE(object_type_strings))
                return NULL;
@@ -166,7 +166,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
                if (!quiet)
                        error("object %s is a %s, not a %s",
                              oid_to_hex(&obj->oid),
-                             typename(obj->type), typename(type));
+                             type_name(obj->type), type_name(type));
                return NULL;
        }
 }
@@ -265,7 +265,7 @@ struct object *parse_object(const struct object_id *oid)
 
        buffer = read_sha1_file(oid->hash, &type, &size);
        if (buffer) {
-               if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
+               if (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {
                        free(buffer);
                        error("sha1 mismatch %s", sha1_to_hex(repl));
                        return NULL;
index 87563d90562b51859da8313b105a3e7785ed9d26..a5eb263808e8f1969a625578a22f33c0aff2ef0a 100644 (file)
--- a/object.h
+++ b/object.h
@@ -53,7 +53,7 @@ struct object {
        struct object_id oid;
 };
 
-extern const char *typename(unsigned int type);
+extern const char *type_name(unsigned int type);
 extern int type_from_string_gently(const char *str, ssize_t, int gentle);
 #define type_from_string(str) type_from_string_gently(str, -1, 0)
 
index 073c1fbd46dfeeb215c209aa0659768e72b81c3b..bd348592f643c6ee8919febb86ca0ac913a5c5f5 100644 (file)
@@ -141,7 +141,7 @@ static int verify_packfile(struct packed_git *p,
                        err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
                                    oid_to_hex(entries[i].oid.oid), p->pack_name,
                                    (uintmax_t)entries[i].offset);
-               else if (check_sha1_signature(entries[i].oid.hash, data, size, typename(type)))
+               else if (check_sha1_signature(entries[i].oid.hash, data, size, type_name(type)))
                        err = error("packed %s from %s is corrupt",
                                    oid_to_hex(entries[i].oid.oid), p->pack_name);
                else if (fn) {
index 6657a0a499f543b39dfd96f89c4e00eca2f93d9b..0532a371b2d90a356aa65efc558771b196da57a5 100644 (file)
@@ -1357,7 +1357,7 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
                if (oi->typep)
                        *oi->typep = ptot;
                if (oi->type_name) {
-                       const char *tn = typename(ptot);
+                       const char *tn = type_name(ptot);
                        if (tn)
                                strbuf_addstr(oi->type_name, tn);
                }
index 88d7d679da9c837463f74d9a9277025b008635af..191ebe3e6a99d26913a510967a9545f53db58bc8 100644 (file)
@@ -94,7 +94,7 @@ static void add_recent_object(const struct object_id *oid,
                break;
        default:
                die("unknown object type for %s: %s",
-                   oid_to_hex(oid), typename(type));
+                   oid_to_hex(oid), type_name(type));
        }
 
        if (!obj)
index f9e25aea7a97e18b5723c8fa379da859d6dc9fcf..9dae6cfe3f33950afc6c9e1781c4b1c6f0d58ce7 100644 (file)
@@ -769,7 +769,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
                if (deref)
                        name++;
                if (!strcmp(name, "objecttype"))
-                       v->s = typename(obj->type);
+                       v->s = type_name(obj->type);
                else if (!strcmp(name, "objectsize")) {
                        v->value = sz;
                        v->s = xstrfmt("%lu", sz);
@@ -795,7 +795,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
                if (!strcmp(name, "tag"))
                        v->s = tag->tag;
                else if (!strcmp(name, "type") && tag->tagged)
-                       v->s = typename(tag->tagged->type);
+                       v->s = type_name(tag->tagged->type);
                else if (!strcmp(name, "object") && tag->tagged)
                        v->s = xstrdup(oid_to_hex(&tag->tagged->oid));
        }
index 4d3f60594cbf0e9ddf2ea78e8c58eca312b4cac0..f6b77e6bda2f197fa3fb68fde244bf86015cb54f 100644 (file)
@@ -2348,7 +2348,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
                        if (!lookup_commit_reference_gently(&oid, 1)) {
                                enum object_type type = sha1_object_info(oid.hash, NULL);
                                return error(_("%s: can't cherry-pick a %s"),
-                                       name, typename(type));
+                                       name, type_name(type));
                        }
                } else
                        return error(_("%s: bad revision"), name);
index 2c03458eaf31197ce21d9f30764912e4782aaa93..2288bb75cd75c5c366ea86fbd35896cc306a59ee 100644 (file)
@@ -805,7 +805,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
                return -1;
 
        /* Generate the header */
-       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(obj_type), size) + 1;
+       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(obj_type), size) + 1;
 
        /* Sha1.. */
        git_SHA1_Init(&c);
@@ -1240,7 +1240,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
                        if (oi->delta_base_sha1)
                                hashclr(oi->delta_base_sha1);
                        if (oi->type_name)
-                               strbuf_addstr(oi->type_name, typename(co->type));
+                               strbuf_addstr(oi->type_name, type_name(co->type));
                        if (oi->contentp)
                                *oi->contentp = xmemdupz(co->buf, co->size);
                        oi->whence = OI_CACHED;
@@ -1317,7 +1317,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
 {
        struct cached_object *co;
 
-       hash_sha1_file(buf, len, typename(type), sha1);
+       hash_sha1_file(buf, len, type_name(type), sha1);
        if (has_sha1_file(sha1) || find_cached_object(sha1))
                return 0;
        ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
@@ -1683,7 +1683,7 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
        buf = read_object(sha1, &type, &len);
        if (!buf)
                return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
-       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
        ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
        free(buf);
 
@@ -1767,9 +1767,9 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,
        }
 
        if (write_object)
-               ret = write_sha1_file(buf, size, typename(type), oid->hash);
+               ret = write_sha1_file(buf, size, type_name(type), oid->hash);
        else
-               ret = hash_sha1_file(buf, size, typename(type), oid->hash);
+               ret = hash_sha1_file(buf, size, type_name(type), oid->hash);
        if (re_allocated)
                free(buf);
        return ret;
@@ -1789,10 +1789,10 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,
                                 get_safe_crlf(flags));
 
        if (write_object)
-               ret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
+               ret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
                                      oid->hash);
        else
-               ret = hash_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
+               ret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
                                     oid->hash);
        strbuf_release(&sbuf);
        return ret;
@@ -1942,7 +1942,7 @@ void assert_sha1_type(const unsigned char *sha1, enum object_type expect)
                die("%s is not a valid object", sha1_to_hex(sha1));
        if (type != expect)
                die("%s is not a valid '%s' object", sha1_to_hex(sha1),
-                   typename(expect));
+                   type_name(expect));
 }
 
 int for_each_file_in_obj_subdir(unsigned int subdir_nr,
@@ -2187,7 +2187,7 @@ int read_loose_object(const char *path,
                        goto out;
                }
                if (check_sha1_signature(expected_sha1, *contents,
-                                        *size, typename(*type))) {
+                                        *size, type_name(*type))) {
                        error("sha1 mismatch for %s (expected %s)", path,
                              sha1_to_hex(expected_sha1));
                        free(*contents);
index 611c7d24ddee678470ba74cb3c2ca669a778b44a..e7c18ffc26daf1962f90da9ff5c16cc608149d9d 100644 (file)
@@ -381,7 +381,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
 
        advise("  %s %s%s",
               find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
-              typename(type) ? typename(type) : "unknown type",
+              type_name(type) ? type_name(type) : "unknown type",
               desc.buf);
 
        strbuf_release(&desc);
@@ -901,8 +901,8 @@ struct object *peel_to_type(const char *name, int namelen,
                        if (name)
                                error("%.*s: expected %s type, but the object "
                                      "dereferences to %s type",
-                                     namelen, name, typename(expected_type),
-                                     typename(o->type));
+                                     namelen, name, type_name(expected_type),
+                                     type_name(o->type));
                        return NULL;
                }
        }
index 47ddc9b2739bf52d9263ea9cd90edde6e9d1c738..cd18400e870a3b8119aee73048fdf3a4a9eaa405 100644 (file)
@@ -831,7 +831,7 @@ static int check_has_commit(const struct object_id *oid, void *data)
                return 0;
        default:
                die(_("submodule entry '%s' (%s) is a %s, not a commit"),
-                   cb->path, oid_to_hex(oid), typename(type));
+                   cb->path, oid_to_hex(oid), type_name(type));
        }
 }
 
diff --git a/tag.c b/tag.c
index fcbe012f7a2203e198dac9eac03aa9dab999f334..66210fd4772778ac4c95925ec4670717dd27da62 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -47,7 +47,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
                                name_to_report ?
                                name_to_report :
                                find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
-                               typename(type));
+                               type_name(type));
 
        buf = read_sha1_file(oid->hash, &type, &size);
        if (!buf)
index 5d4d3733f75648dfa8d6955a5ec1ed9f3dfeb77b..dffb9c8e37c220e71e108060dc5a81bc21f8370c 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -22,7 +22,7 @@ void walker_say(struct walker *walker, const char *fmt, ...)
 static void report_missing(const struct object *obj)
 {
        fprintf(stderr, "Cannot obtain needed %s %s\n",
-               obj->type ? typename(obj->type): "object",
+               obj->type ? type_name(obj->type): "object",
                oid_to_hex(&obj->oid));
        if (!is_null_oid(&current_commit_oid))
                fprintf(stderr, "while processing commit %s.\n",
@@ -134,7 +134,7 @@ static int process_object(struct walker *walker, struct object *obj)
        }
        return error("Unable to determine requirements "
                     "of type %s for %s",
-                    typename(obj->type), oid_to_hex(&obj->oid));
+                    type_name(obj->type), oid_to_hex(&obj->oid));
 }
 
 static int process(struct walker *walker, struct object *obj)