object: rename function 'typename' to 'type_name'

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>

Brandon Williams committed Feb 14, 2018 at 10:59 UTC debca9d2fe784193dc2d9f98b5edac605ddfefbb
32 files changed +73 -73
builtin/cat-file.c
+1 -1
@@ -229,7 +229,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
229 if (data->mark_query)
230 data->info.typep = &data->type;
231 else
232 - strbuf_addstr(sb, typename(data->type));
232 + strbuf_addstr(sb, type_name(data->type));
233 } else if (is_atom("objectsize", atom, len)) {
234 if (data->mark_query)
235 data->info.sizep = &data->size;
builtin/diff-tree.c
+1 -1
@@ -76,7 +76,7 @@ static int diff_tree_stdin(char *line)
76 if (obj->type == OBJ_TREE)
77 return stdin_diff_trees((struct tree *)obj, p);
78 error("Object %s is a %s, not a commit or tree",
79 - oid_to_hex(&oid), typename(obj->type));
79 + oid_to_hex(&oid), type_name(obj->type));
80 return -1;
81 }
82
builtin/fast-export.c
+4 -4
@@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid)
240 buf = read_sha1_file(oid->hash, &type, &size);
241 if (!buf)
242 die ("Could not read blob %s", oid_to_hex(oid));
243 - if (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)
243 + if (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0)
244 die("sha1 mismatch in blob %s", oid_to_hex(oid));
245 object = parse_object_buffer(oid, type, size, buf, &eaten);
246 }
@@ -757,7 +757,7 @@ static void handle_tag(const char *name, struct tag *tag)
757 if (tagged->type != OBJ_COMMIT) {
758 die ("Tag %s tags unexported %s!",
759 oid_to_hex(&tag->object.oid),
760 - typename(tagged->type));
760 + type_name(tagged->type));
761 }
762 p = (struct commit *)tagged;
763 for (;;) {
@@ -839,7 +839,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
839 if (!commit) {
840 warning("%s: Unexpected object of type %s, skipping.",
841 e->name,
842 - typename(e->item->type));
842 + type_name(e->item->type));
843 continue;
844 }
845
@@ -851,7 +851,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
851 continue;
852 default: /* OBJ_TAG (nested tags) is already handled */
853 warning("Tag points to object of unexpected type %s, skipping.",
854 - typename(commit->object.type));
854 + type_name(commit->object.type));
855 continue;
856 }
857
builtin/fsck.c
+2 -2
@@ -70,7 +70,7 @@ static const char *printable_type(struct object *obj)
70 object_as_type(obj, type, 0);
71 }
72
73 - ret = typename(obj->type);
73 + ret = type_name(obj->type);
74 if (!ret)
75 ret = "unknown";
76
@@ -137,7 +137,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt
137 printf("broken link from %7s %s\n",
138 printable_type(parent), describe_object(parent));
139 printf("broken link from %7s %s\n",
140 - (type == OBJ_ANY ? "unknown" : typename(type)), "unknown");
140 + (type == OBJ_ANY ? "unknown" : type_name(type)), "unknown");
141 errors_found |= ERROR_REACHABLE;
142 return 1;
143 }
builtin/grep.c
+1 -1
@@ -627,7 +627,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
627 free(data);
628 return hit;
629 }
630 - die(_("unable to grep from object of type %s"), typename(obj->type));
630 + die(_("unable to grep from object of type %s"), type_name(obj->type));
631 }
632
633 static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
builtin/index-pack.c
+6 -6
@@ -228,7 +228,7 @@ static unsigned check_object(struct object *obj)
228 if (type != obj->type)
229 die(_("object %s: expected type %s, found %s"),
230 oid_to_hex(&obj->oid),
231 - typename(obj->type), typename(type));
231 + type_name(obj->type), type_name(type));
232 obj->flags |= FLAG_CHECKED;
233 return 1;
234 }
@@ -448,7 +448,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
448 int hdrlen;
449
450 if (!is_delta_type(type)) {
451 - hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
451 + hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), size) + 1;
452 git_SHA1_Init(&c);
453 git_SHA1_Update(&c, hdr, hdrlen);
454 } else
@@ -849,7 +849,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
849 obj = parse_object_buffer(oid, type, size, buf,
850 &eaten);
851 if (!obj)
852 - die(_("invalid %s"), typename(type));
852 + die(_("invalid %s"), type_name(type));
853 if (do_fsck_object &&
854 fsck_object(obj, buf, size, &fsck_options))
855 die(_("Error in object"));
@@ -959,7 +959,7 @@ static void resolve_delta(struct object_entry *delta_obj,
959 if (!result->data)
960 bad_object(delta_obj->idx.offset, _("failed to apply delta"));
961 hash_sha1_file(result->data, result->size,
962 - typename(delta_obj->real_type),
962 + type_name(delta_obj->real_type),
963 delta_obj->idx.oid.hash);
964 sha1_object(result->data, NULL, result->size, delta_obj->real_type,
965 &delta_obj->idx.oid);
@@ -1379,7 +1379,7 @@ static void fix_unresolved_deltas(struct sha1file *f)
1379 continue;
1380
1381 if (check_sha1_signature(d->sha1, base_obj->data,
1382 - base_obj->size, typename(type)))
1382 + base_obj->size, type_name(type)))
1383 die(_("local object %s is corrupt"), sha1_to_hex(d->sha1));
1384 base_obj->obj = append_obj_to_pack(f, d->sha1,
1385 base_obj->data, base_obj->size, type);
@@ -1588,7 +1588,7 @@ static void show_pack_info(int stat_only)
1588 continue;
1589 printf("%s %-6s %lu %lu %"PRIuMAX,
1590 oid_to_hex(&obj->idx.oid),
1591 - typename(obj->real_type), obj->size,
1591 + type_name(obj->real_type), obj->size,
1592 (unsigned long)(obj[1].idx.offset - obj->idx.offset),
1593 (uintmax_t)obj->idx.offset);
1594 if (is_delta_type(obj->type)) {
builtin/merge.c
+1 -1
@@ -520,7 +520,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
520 if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
521 strbuf_addf(msg, "%s\t\t%s '%s'\n",
522 oid_to_hex(&desc->obj->oid),
523 - typename(desc->obj->type),
523 + type_name(desc->obj->type),
524 remote);
525 goto cleanup;
526 }
builtin/mktree.c
+2 -2
@@ -112,7 +112,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
112 mode_type = object_type(mode);
113 if (mode_type != type_from_string(ptr)) {
114 die("entry '%s' object type (%s) doesn't match mode type (%s)",
115 - path, ptr, typename(mode_type));
115 + path, ptr, type_name(mode_type));
116 }
117
118 /* 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
131 * because the new tree entry will never be correct.
132 */
133 die("entry '%s' object %s is a %s but specified type was (%s)",
134 - path, sha1_to_hex(sha1), typename(obj_type), typename(mode_type));
134 + path, sha1_to_hex(sha1), type_name(obj_type), type_name(mode_type));
135 }
136 }
137
builtin/prune.c
+1 -1
@@ -52,7 +52,7 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
52 if (show_only || verbose) {
53 enum object_type type = sha1_object_info(oid->hash, NULL);
54 printf("%s %s\n", oid_to_hex(oid),
55 - (type > 0) ? typename(type) : "unknown");
55 + (type > 0) ? type_name(type) : "unknown");
56 }
57 if (!show_only)
58 unlink_or_warn(fullpath);
builtin/replace.c
+6 -6
@@ -56,8 +56,8 @@ static int show_reference(const char *refname, const struct object_id *oid,
56 obj_type = sha1_object_info(object.hash, NULL);
57 repl_type = sha1_object_info(oid->hash, NULL);
58
59 - printf("%s (%s) -> %s (%s)\n", refname, typename(obj_type),
60 - oid_to_hex(oid), typename(repl_type));
59 + printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
60 + oid_to_hex(oid), type_name(repl_type));
61 }
62 }
63
@@ -168,8 +168,8 @@ static int replace_object_oid(const char *object_ref,
168 die("Objects must be of the same type.\n"
169 "'%s' points to a replaced object of type '%s'\n"
170 "while '%s' points to a replacement object of type '%s'.",
171 - object_ref, typename(obj_type),
172 - replace_ref, typename(repl_type));
171 + object_ref, type_name(obj_type),
172 + replace_ref, type_name(repl_type));
173
174 check_ref_valid(object, &prev, &ref, force);
175
@@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,
215 argv_array_push(&cmd.args, "--no-replace-objects");
216 argv_array_push(&cmd.args, "cat-file");
217 if (raw)
218 - argv_array_push(&cmd.args, typename(type));
218 + argv_array_push(&cmd.args, type_name(type));
219 else
220 argv_array_push(&cmd.args, "-p");
221 argv_array_push(&cmd.args, oid_to_hex(oid));
@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
355 struct tag *tag;
356 int i;
357
358 - hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
358 + hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);
359 tag = lookup_tag(&tag_oid);
360 if (!tag)
361 die(_("bad mergetag in commit '%s'"), ref);
builtin/tag.c
+1 -1
@@ -220,7 +220,7 @@ static void create_tag(const struct object_id *object, const char *tag,
220 "tag %s\n"
221 "tagger %s\n\n",
222 oid_to_hex(object),
223 - typename(type),
223 + type_name(type),
224 tag,
225 git_committer_info(IDENT_STRICT));
226
builtin/unpack-objects.c
+5 -5
@@ -172,7 +172,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
172 {
173 struct object_id oid;
174
175 - if (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0)
175 + if (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)
176 die("failed to write object %s", oid_to_hex(&obj->oid));
177 obj->flags |= FLAG_WRITTEN;
178 }
@@ -237,14 +237,14 @@ static void write_object(unsigned nr, enum object_type type,
237 void *buf, unsigned long size)
238 {
239 if (!strict) {
240 - if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
240 + if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
241 die("failed to write object");
242 added_object(nr, type, buf, size);
243 free(buf);
244 obj_list[nr].obj = NULL;
245 } else if (type == OBJ_BLOB) {
246 struct blob *blob;
247 - if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
247 + if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
248 die("failed to write object");
249 added_object(nr, type, buf, size);
250 free(buf);
@@ -258,12 +258,12 @@ static void write_object(unsigned nr, enum object_type type,
258 } else {
259 struct object *obj;
260 int eaten;
261 - hash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);
261 + hash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);
262 added_object(nr, type, buf, size);
263 obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
264 &eaten);
265 if (!obj)
266 - die("invalid %s", typename(type));
266 + die("invalid %s", type_name(type));
267 add_object_buffer(obj, buf, size);
268 obj->flags |= FLAG_OPEN;
269 obj_list[nr].obj = obj;
builtin/verify-commit.c
+1 -1
@@ -49,7 +49,7 @@ static int verify_commit(const char *name, unsigned flags)
49 return error("%s: unable to read file.", name);
50 if (type != OBJ_COMMIT)
51 return error("%s: cannot verify a non-commit object of type %s.",
52 - name, typename(type));
52 + name, type_name(type));
53
54 ret = run_gpg_verify(&oid, buf, size, flags);
55
bulk-checkin.c
+1 -1
@@ -203,7 +203,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
203 return error("cannot find the current offset");
204
205 header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
206 - typename(type), (uintmax_t)size) + 1;
206 + type_name(type), (uintmax_t)size) + 1;
207 git_SHA1_Init(&ctx);
208 git_SHA1_Update(&ctx, obuf, header_len);
209
commit.c
+1 -1
@@ -274,7 +274,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
274 oid_to_hex(&commit->object.oid));
275 if (type != OBJ_COMMIT)
276 die("expected commit for %s, got %s",
277 - oid_to_hex(&commit->object.oid), typename(type));
277 + oid_to_hex(&commit->object.oid), type_name(type));
278 if (sizep)
279 *sizep = size;
280 }
contrib/examples/builtin-fetch--tool.c
+1 -1
@@ -15,7 +15,7 @@ static char *get_stdin(void)
15
16 static void show_new(enum object_type type, unsigned char *sha1_new)
17 {
18 - fprintf(stderr, " %s: %s\n", typename(type),
18 + fprintf(stderr, " %s: %s\n", type_name(type),
19 find_unique_abbrev(sha1_new, DEFAULT_ABBREV));
20 }
21
fast-import.c
+8 -8
@@ -1096,7 +1096,7 @@ static int store_object(
1096 git_zstream s;
1097
1098 hdrlen = xsnprintf((char *)hdr, sizeof(hdr), "%s %lu",
1099 - typename(type), (unsigned long)dat->len) + 1;
1099 + type_name(type), (unsigned long)dat->len) + 1;
1100 git_SHA1_Init(&c);
1101 git_SHA1_Update(&c, hdr, hdrlen);
1102 git_SHA1_Update(&c, dat->buf, dat->len);
@@ -2421,7 +2421,7 @@ static void file_change_m(const char *p, struct branch *b)
2421 else if (oe) {
2422 if (oe->type != OBJ_COMMIT)
2423 die("Not a commit (actually a %s): %s",
2424 - typename(oe->type), command_buf.buf);
2424 + type_name(oe->type), command_buf.buf);
2425 }
2426 /*
2427 * 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)
2448 command_buf.buf);
2449 if (type != expected)
2450 die("Not a %s (actually a %s): %s",
2451 - typename(expected), typename(type),
2451 + type_name(expected), type_name(type),
2452 command_buf.buf);
2453 }
2454
@@ -2599,14 +2599,14 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
2599 } else if (oe) {
2600 if (oe->type != OBJ_BLOB)
2601 die("Not a blob (actually a %s): %s",
2602 - typename(oe->type), command_buf.buf);
2602 + type_name(oe->type), command_buf.buf);
2603 } else if (!is_null_oid(&oid)) {
2604 enum object_type type = sha1_object_info(oid.hash, NULL);
2605 if (type < 0)
2606 die("Blob not found: %s", command_buf.buf);
2607 if (type != OBJ_BLOB)
2608 die("Not a blob (actually a %s): %s",
2609 - typename(type), command_buf.buf);
2609 + type_name(type), command_buf.buf);
2610 }
2611
2612 construct_path_with_fanout(oid_to_hex(&commit_oid), *old_fanout, path);
@@ -2914,7 +2914,7 @@ static void parse_new_tag(const char *arg)
2914 "object %s\n"
2915 "type %s\n"
2916 "tag %s\n",
2917 - oid_to_hex(&oid), typename(type), t->name);
2917 + oid_to_hex(&oid), type_name(type), t->name);
2918 if (tagger)
2919 strbuf_addf(&new_data,
2920 "tagger %s\n", tagger);
@@ -2985,10 +2985,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
2985 die("Can't read object %s", oid_to_hex(oid));
2986 if (type != OBJ_BLOB)
2987 die("Object %s is a %s but a blob was expected.",
2988 - oid_to_hex(oid), typename(type));
2988 + oid_to_hex(oid), type_name(type));
2989 strbuf_reset(&line);
2990 strbuf_addf(&line, "%s %s %lu\n", oid_to_hex(oid),
2991 - typename(type), size);
2991 + type_name(type), size);
2992 cat_blob_write(line.buf, line.len);
2993 strbuf_release(&line);
2994 cat_blob_write(buf, size);
fsck.c
+1 -1
@@ -821,7 +821,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
821 ret = report(options, &tag->object,
822 FSCK_MSG_TAG_OBJECT_NOT_TAG,
823 "expected tag got %s",
824 - typename(type));
824 + type_name(type));
825 goto done;
826 }
827 }
http-push.c
+1 -1
@@ -362,7 +362,7 @@ static void start_put(struct transfer_request *request)
362 git_zstream stream;
363
364 unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
365 - hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
365 + hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
366
367 /* Set it up */
368 git_deflate_init(&stream, zlib_compression_level);
log-tree.c
+1 -1
@@ -499,7 +499,7 @@ static void show_one_mergetag(struct commit *commit,
499 int status, nth;
500 size_t payload_size, gpg_message_offset;
501
502 - hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
502 + hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);
503 tag = lookup_tag(&oid);
504 if (!tag)
505 return; /* error message already given */
object.c
+3 -3
@@ -26,7 +26,7 @@ static const char *object_type_strings[] = {
26 "tag", /* OBJ_TAG = 4 */
27 };
28
29 -const char *typename(unsigned int type)
29 +const char *type_name(unsigned int type)
30 {
31 if (type >= ARRAY_SIZE(object_type_strings))
32 return NULL;
@@ -166,7 +166,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
166 if (!quiet)
167 error("object %s is a %s, not a %s",
168 oid_to_hex(&obj->oid),
169 - typename(obj->type), typename(type));
169 + type_name(obj->type), type_name(type));
170 return NULL;
171 }
172 }
@@ -265,7 +265,7 @@ struct object *parse_object(const struct object_id *oid)
265
266 buffer = read_sha1_file(oid->hash, &type, &size);
267 if (buffer) {
268 - if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
268 + if (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {
269 free(buffer);
270 error("sha1 mismatch %s", sha1_to_hex(repl));
271 return NULL;
object.h
+1 -1
@@ -53,7 +53,7 @@ struct object {
53 struct object_id oid;
54 };
55
56 -extern const char *typename(unsigned int type);
56 +extern const char *type_name(unsigned int type);
57 extern int type_from_string_gently(const char *str, ssize_t, int gentle);
58 #define type_from_string(str) type_from_string_gently(str, -1, 0)
59
pack-check.c
+1 -1
@@ -141,7 +141,7 @@ static int verify_packfile(struct packed_git *p,
141 err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
142 oid_to_hex(entries[i].oid.oid), p->pack_name,
143 (uintmax_t)entries[i].offset);
144 - else if (check_sha1_signature(entries[i].oid.hash, data, size, typename(type)))
144 + else if (check_sha1_signature(entries[i].oid.hash, data, size, type_name(type)))
145 err = error("packed %s from %s is corrupt",
146 oid_to_hex(entries[i].oid.oid), p->pack_name);
147 else if (fn) {
packfile.c
+1 -1
@@ -1357,7 +1357,7 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
1357 if (oi->typep)
1358 *oi->typep = ptot;
1359 if (oi->type_name) {
1360 - const char *tn = typename(ptot);
1360 + const char *tn = type_name(ptot);
1361 if (tn)
1362 strbuf_addstr(oi->type_name, tn);
1363 }
reachable.c
+1 -1
@@ -94,7 +94,7 @@ static void add_recent_object(const struct object_id *oid,
94 break;
95 default:
96 die("unknown object type for %s: %s",
97 - oid_to_hex(oid), typename(type));
97 + oid_to_hex(oid), type_name(type));
98 }
99
100 if (!obj)
ref-filter.c
+2 -2
@@ -769,7 +769,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
769 if (deref)
770 name++;
771 if (!strcmp(name, "objecttype"))
772 - v->s = typename(obj->type);
772 + v->s = type_name(obj->type);
773 else if (!strcmp(name, "objectsize")) {
774 v->value = sz;
775 v->s = xstrfmt("%lu", sz);
@@ -795,7 +795,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
795 if (!strcmp(name, "tag"))
796 v->s = tag->tag;
797 else if (!strcmp(name, "type") && tag->tagged)
798 - v->s = typename(tag->tagged->type);
798 + v->s = type_name(tag->tagged->type);
799 else if (!strcmp(name, "object") && tag->tagged)
800 v->s = xstrdup(oid_to_hex(&tag->tagged->oid));
801 }
sequencer.c
+1 -1
@@ -2348,7 +2348,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
2348 if (!lookup_commit_reference_gently(&oid, 1)) {
2349 enum object_type type = sha1_object_info(oid.hash, NULL);
2350 return error(_("%s: can't cherry-pick a %s"),
2351 - name, typename(type));
2351 + name, type_name(type));
2352 }
2353 } else
2354 return error(_("%s: bad revision"), name);
sha1_file.c
+10 -10
@@ -805,7 +805,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
805 return -1;
806
807 /* Generate the header */
808 - hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(obj_type), size) + 1;
808 + hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(obj_type), size) + 1;
809
810 /* Sha1.. */
811 git_SHA1_Init(&c);
@@ -1240,7 +1240,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
1240 if (oi->delta_base_sha1)
1241 hashclr(oi->delta_base_sha1);
1242 if (oi->type_name)
1243 - strbuf_addstr(oi->type_name, typename(co->type));
1243 + strbuf_addstr(oi->type_name, type_name(co->type));
1244 if (oi->contentp)
1245 *oi->contentp = xmemdupz(co->buf, co->size);
1246 oi->whence = OI_CACHED;
@@ -1317,7 +1317,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
1317 {
1318 struct cached_object *co;
1319
1320 - hash_sha1_file(buf, len, typename(type), sha1);
1320 + hash_sha1_file(buf, len, type_name(type), sha1);
1321 if (has_sha1_file(sha1) || find_cached_object(sha1))
1322 return 0;
1323 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)
1683 buf = read_object(sha1, &type, &len);
1684 if (!buf)
1685 return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
1686 - hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
1686 + hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
1687 ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
1688 free(buf);
1689
@@ -1767,9 +1767,9 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,
1767 }
1768
1769 if (write_object)
1770 - ret = write_sha1_file(buf, size, typename(type), oid->hash);
1770 + ret = write_sha1_file(buf, size, type_name(type), oid->hash);
1771 else
1772 - ret = hash_sha1_file(buf, size, typename(type), oid->hash);
1772 + ret = hash_sha1_file(buf, size, type_name(type), oid->hash);
1773 if (re_allocated)
1774 free(buf);
1775 return ret;
@@ -1789,10 +1789,10 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,
1789 get_safe_crlf(flags));
1790
1791 if (write_object)
1792 - ret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
1792 + ret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
1793 oid->hash);
1794 else
1795 - ret = hash_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
1795 + ret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
1796 oid->hash);
1797 strbuf_release(&sbuf);
1798 return ret;
@@ -1942,7 +1942,7 @@ void assert_sha1_type(const unsigned char *sha1, enum object_type expect)
1942 die("%s is not a valid object", sha1_to_hex(sha1));
1943 if (type != expect)
1944 die("%s is not a valid '%s' object", sha1_to_hex(sha1),
1945 - typename(expect));
1945 + type_name(expect));
1946 }
1947
1948 int for_each_file_in_obj_subdir(unsigned int subdir_nr,
@@ -2187,7 +2187,7 @@ int read_loose_object(const char *path,
2187 goto out;
2188 }
2189 if (check_sha1_signature(expected_sha1, *contents,
2190 - *size, typename(*type))) {
2190 + *size, type_name(*type))) {
2191 error("sha1 mismatch for %s (expected %s)", path,
2192 sha1_to_hex(expected_sha1));
2193 free(*contents);
sha1_name.c
+3 -3
@@ -381,7 +381,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
381
382 advise(" %s %s%s",
383 find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
384 - typename(type) ? typename(type) : "unknown type",
384 + type_name(type) ? type_name(type) : "unknown type",
385 desc.buf);
386
387 strbuf_release(&desc);
@@ -901,8 +901,8 @@ struct object *peel_to_type(const char *name, int namelen,
901 if (name)
902 error("%.*s: expected %s type, but the object "
903 "dereferences to %s type",
904 - namelen, name, typename(expected_type),
905 - typename(o->type));
904 + namelen, name, type_name(expected_type),
905 + type_name(o->type));
906 return NULL;
907 }
908 }
submodule.c
+1 -1
@@ -831,7 +831,7 @@ static int check_has_commit(const struct object_id *oid, void *data)
831 return 0;
832 default:
833 die(_("submodule entry '%s' (%s) is a %s, not a commit"),
834 - cb->path, oid_to_hex(oid), typename(type));
834 + cb->path, oid_to_hex(oid), type_name(type));
835 }
836 }
837
tag.c
+1 -1
@@ -47,7 +47,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
47 name_to_report ?
48 name_to_report :
49 find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
50 - typename(type));
50 + type_name(type));
51
52 buf = read_sha1_file(oid->hash, &type, &size);
53 if (!buf)
walker.c
+2 -2
@@ -22,7 +22,7 @@ void walker_say(struct walker *walker, const char *fmt, ...)
22 static void report_missing(const struct object *obj)
23 {
24 fprintf(stderr, "Cannot obtain needed %s %s\n",
25 - obj->type ? typename(obj->type): "object",
25 + obj->type ? type_name(obj->type): "object",
26 oid_to_hex(&obj->oid));
27 if (!is_null_oid(&current_commit_oid))
28 fprintf(stderr, "while processing commit %s.\n",
@@ -134,7 +134,7 @@ static int process_object(struct walker *walker, struct object *obj)
134 }
135 return error("Unable to determine requirements "
136 "of type %s for %s",
137 - typename(obj->type), oid_to_hex(&obj->oid));
137 + type_name(obj->type), oid_to_hex(&obj->oid));
138 }
139
140 static int process(struct walker *walker, struct object *obj)