X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tag.c;h=74d0dabe5d8c1f06a3f67475368c34e3b4046456;hb=06d30f4f3eea71bce4cf48db3ea384976b3983b7;hp=f390ee703036bc74d6447d7e96c828310a948c2b;hpb=b642d9ef643371990c0a921836f2a074d48ce1b3;p=git.git diff --git a/tag.c b/tag.c index f390ee703..74d0dabe5 100644 --- a/tag.c +++ b/tag.c @@ -5,7 +5,7 @@ const char *tag_type = "tag"; struct object *deref_tag(struct object *o, const char *warn, int warnlen) { - while (o && o->type == tag_type) + while (o && o->type == TYPE_TAG) o = parse_object(((struct tag *)o)->tagged->sha1); if (!o && warn) { if (!warnlen) @@ -19,16 +19,16 @@ struct tag *lookup_tag(const unsigned char *sha1) { struct object *obj = lookup_object(sha1); if (!obj) { - struct tag *ret = xcalloc(1, sizeof(struct tag)); + struct tag *ret = alloc_tag_node(); created_object(sha1, &ret->object); - ret->object.type = tag_type; + ret->object.type = TYPE_TAG; return ret; } if (!obj->type) - obj->type = tag_type; - if (obj->type != tag_type) { - error("Object %s is a %s, not a tree", - sha1_to_hex(sha1), obj->type); + obj->type = TYPE_TAG; + if (obj->type != TYPE_TAG) { + error("Object %s is a %s, not a tree", + sha1_to_hex(sha1), typename(obj->type)); return NULL; } return (struct tag *) obj; @@ -47,10 +47,10 @@ int parse_tag_buffer(struct tag *item, void *data, unsigned long size) if (size < 64) return -1; - if (memcmp("object ", data, 7) || get_sha1_hex(data + 7, object)) + if (memcmp("object ", data, 7) || get_sha1_hex((char *) data + 7, object)) return -1; - type_line = data + 48; + type_line = (char *) data + 48; if (memcmp("\ntype ", type_line-1, 6)) return -1;