/*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2009 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* @APPLE_LICENSE_HEADER_END@
*/
/* CFPlugIn_Instance.c
- Copyright (c) 1999-2007 Apple Inc. All rights reserved.
+ Copyright (c) 1999-2009, Apple Inc. All rights reserved.
Responsibility: Doug Davidson
*/
(void)INVOKE_CALLBACK1(instance->deallocateInstanceDataFunction, (void *)(&instance->_instanceData[0]));
}
- if (instance->factory) {
- _CFPFactoryRemoveInstance(instance->factory);
- }
+ if (instance->factory) _CFPFactoryRemoveInstance(instance->factory);
}
static const CFRuntimeClass __CFPlugInInstanceClass = {
CFTypeID CFPlugInInstanceGetTypeID(void) {
return __kCFPlugInInstanceTypeID;
}
+
CF_EXPORT CFPlugInInstanceRef CFPlugInInstanceCreateWithInstanceDataSize(CFAllocatorRef allocator, CFIndex instanceDataSize, CFPlugInInstanceDeallocateInstanceDataFunction deallocateInstanceFunction, CFStringRef factoryName, CFPlugInInstanceGetInterfaceFunction getInterfaceFunction) {
CFPlugInInstanceRef instance;
UInt32 size;
size = sizeof(struct __CFPlugInInstance) + instanceDataSize - sizeof(CFRuntimeBase);
instance = (CFPlugInInstanceRef)_CFRuntimeCreateInstance(allocator, __kCFPlugInInstanceTypeID, size, NULL);
- if (NULL == instance) {
- return NULL;
- }
+ if (!instance) return NULL;
instance->factory = _CFPFactoryFind((CFUUIDRef)factoryName, true);
- if (instance->factory) {
- _CFPFactoryAddInstance(instance->factory);
- }
+ if (instance->factory) _CFPFactoryAddInstance(instance->factory);
instance->getInterfaceFunction = getInterfaceFunction;
instance->deallocateInstanceDataFunction = deallocateInstanceFunction;
FAULT_CALLBACK((void **)&(instance->getInterfaceFunction));
result = INVOKE_CALLBACK3(instance->getInterfaceFunction, instance, interfaceName, &myFtbl) ? true : false;
}
- if (ftbl) {
- *ftbl = (result ? myFtbl : NULL);
- }
+ if (ftbl) *ftbl = (result ? myFtbl : NULL);
return result;
}