CBChainDescriptor * CBNewChainDescriptorFromData(CBByteArray * data,void (*logError)(char *,...)){ CBChainDescriptor * self = malloc(sizeof(*self)); if (NOT self) { logError("Cannot allocate %i bytes of memory in CBNewChainDescriptorFromData\n",sizeof(*self)); return NULL; } CBGetObject(self)->free = CBFreeChainDescriptor; if(CBInitChainDescriptorFromData(self,data,logError)) return self; free(self); return NULL; }
CBChainDescriptor * CBNewChainDescriptorFromData(CBByteArray * data){ CBChainDescriptor * self = malloc(sizeof(*self)); CBGetObject(self)->free = CBFreeChainDescriptor; CBInitChainDescriptorFromData(self, data); return self; }