]> git.saurik.com Git - apple/cf.git/blobdiff - CFPlugIn_Instance.c
CF-550.tar.gz
[apple/cf.git] / CFPlugIn_Instance.c
index 077a2d1daf51d6b8136bee29363f420dae00b09b..6f900c228770870b96790bfd96913cf5b56017c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -21,7 +21,7 @@
  * @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
 */
 
@@ -63,9 +63,7 @@ static void __CFPlugInInstanceDeallocate(CFTypeRef cf) {
         (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 = {
@@ -87,19 +85,16 @@ __private_extern__ void __CFPlugInInstanceInitialize(void) {
 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;
 
@@ -114,9 +109,7 @@ CF_EXPORT Boolean CFPlugInInstanceGetInterfaceFunctionTable(CFPlugInInstanceRef
         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;
 }