X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=tree.c;h=a6032e35ecb2543b6efcae252e5815b804cb6f0a;hb=0225de86a484828bd4abfd697d361d2bd37c48f4;hp=9bbe2da37b24007b6409d5e1e5c61a20d0903628;hpb=422dfaf079eec92ec75ef8f766d66404433ad0b1;p=git.git diff --git a/tree.c b/tree.c index 9bbe2da37..a6032e35e 100644 --- a/tree.c +++ b/tree.c @@ -129,16 +129,16 @@ struct tree *lookup_tree(const unsigned char *sha1) { struct object *obj = lookup_object(sha1); if (!obj) { - struct tree *ret = xcalloc(1, sizeof(struct tree)); + struct tree *ret = alloc_tree_node(); created_object(sha1, &ret->object); - ret->object.type = tree_type; + ret->object.type = OBJ_TREE; return ret; } if (!obj->type) - obj->type = tree_type; - if (obj->type != tree_type) { - error("Object %s is a %s, not a tree", - sha1_to_hex(sha1), obj->type); + obj->type = OBJ_TREE; + if (obj->type != OBJ_TREE) { + error("Object %s is a %s, not a tree", + sha1_to_hex(sha1), typename(obj->type)); return NULL; } return (struct tree *) obj; @@ -216,11 +216,11 @@ struct tree *parse_tree_indirect(const unsigned char *sha1) do { if (!obj) return NULL; - if (obj->type == tree_type) + if (obj->type == OBJ_TREE) return (struct tree *) obj; - else if (obj->type == commit_type) + else if (obj->type == OBJ_COMMIT) obj = &(((struct commit *) obj)->tree->object); - else if (obj->type == tag_type) + else if (obj->type == OBJ_TAG) obj = ((struct tag *) obj)->tagged; else return NULL;