#include "blob.h"#include "cache.h"#include <stdlib.h>constchar*blob_type="blob";structblob*lookup_blob(unsignedchar*sha1){structobject*obj=lookup_object(sha1);if(!obj){structblob*ret=malloc(sizeof(structblob));memset(ret,0,sizeof(structblob));created_object(sha1,&ret->object);ret->object.type=blob_type;ret->object.parsed=1;returnret;}if(obj->parsed&&obj->type!=blob_type){error("Object %s is a %s, not a blob",sha1_to_hex(sha1),obj->type);returnNULL;}return(structblob*)obj;}