[PATCH 4/7] add object_as_type helper for casting objects

2014-07-11 Thread Jeff King
When we call lookup_commit, lookup_tree, etc, the logic goes something like: 1. Look for an existing object struct. If we don't have one, allocate and return a new one. 2. Double check that any object we have is the expected type (and complain and return NULL otherwise). 3.

Re: [PATCH 4/7] add object_as_type helper for casting objects

2014-07-11 Thread Ramsay Jones
On 11/07/14 09:48, Jeff King wrote: [snip] diff --git a/object.c b/object.c index 472aa8d..b2319f6 100644 --- a/object.c +++ b/object.c @@ -158,6 +158,23 @@ void *create_object(const unsigned char *sha1, void *o) return obj; } +void *object_as_type(struct object *obj, enum