]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_utilities/lib/cfclass.cpp
Security-59754.80.3.tar.gz
[apple/security.git] / OSX / libsecurity_utilities / lib / cfclass.cpp
index 75244e0ca2597b7e38cbeb55ef69593b7e6117cb..6beabd295a1794d316cdba6b5310ea04adf2fd59 100644 (file)
@@ -26,8 +26,6 @@
 #include <security_utilities/threading.h>
 #include <CoreFoundation/CFString.h>
 #include <sys/time.h>
-#include <auto_zone.h>
-#include <objc/objc-auto.h>
 
 //
 // CFClass
@@ -60,42 +58,11 @@ CFClass::cleanupObject(intptr_t op, CFTypeRef cf, bool &zap)
     // the default is to not throw away the object
     zap = false;
     
-    bool isGC = CF_IS_COLLECTABLE(cf);
-    
     uint32_t currentCount;
     SecCFObject *obj = SecCFObject::optional(cf);
 
     uint32_t oldCount;
     currentCount = obj->updateRetainCount(op, &oldCount);
-    
-    if (isGC)
-    {
-        auto_zone_t* zone = objc_collectableZone();
-        
-        if (op == -1 && oldCount == 0)
-        {
-            auto_zone_release(zone, (void*) cf);
-        }
-        else if (op == 1 && oldCount == 0 && currentCount == 1)
-        {
-           auto_zone_retain(zone, (void*) cf);
-        }
-        else if (op == -1 && oldCount == 1 && currentCount == 0)
-        {
-            /*
-                To prevent accidental resurrection, just pull it out of the
-                cache.
-            */
-            obj->aboutToDestruct();
-            auto_zone_release(zone, (void*) cf);
-        }
-        else if (op == 0)
-        {
-            return currentCount;
-        }
-        
-        return 0;
-    }
 
     if (op == 0)
     {
@@ -122,7 +89,7 @@ CFClass::cleanupObject(intptr_t op, CFTypeRef cf, bool &zap)
 }
 
 uint32_t
-CFClass::refCountForType(intptr_t op, CFTypeRef cf) throw()
+CFClass::refCountForType(intptr_t op, CFTypeRef cf) _NOEXCEPT
 {
     uint32_t result = 0;
     bool zap = false;
@@ -160,26 +127,17 @@ CFClass::refCountForType(intptr_t op, CFTypeRef cf) throw()
 
 
 void
-CFClass::finalizeType(CFTypeRef cf) throw()
+CFClass::finalizeType(CFTypeRef cf) _NOEXCEPT
 {
     /*
-        Why are we asserting the mutex here as well as in refCountForType?
-        Because the way we control the objects and the queues are different
-        under GC than they are under non-GC operations.
-        
-        In non-GC, we need to control the lifetime of the object.  This means
+        We need to control the lifetime of the object.  This means
         that the cache lock has to be asserted while we are determining if the
         object should live or die.  The mutex is recursive, which means that
         we won't end up with mutex inversion.
-        
-        In GC, GC figures out the lifetime of the object.  We probably don't need
-        to assert the mutex here, but it doesn't hurt.
     */
     
     SecCFObject *obj = SecCFObject::optional(cf);
 
-       bool isCollectable = CF_IS_COLLECTABLE(cf);
-
     try
        {
                Mutex* mutex = obj->getMutexForObject();
@@ -207,15 +165,10 @@ CFClass::finalizeType(CFTypeRef cf) throw()
        catch(...)
        {
        }
-    
-    if (isCollectable)
-    {
-        delete obj;
-    }
 }
 
 Boolean
-CFClass::equalType(CFTypeRef cf1, CFTypeRef cf2) throw()
+CFClass::equalType(CFTypeRef cf1, CFTypeRef cf2) _NOEXCEPT
 {
        // CF checks for pointer equality and ensures type equality already
        try {
@@ -226,7 +179,7 @@ CFClass::equalType(CFTypeRef cf1, CFTypeRef cf2) throw()
 }
 
 CFHashCode
-CFClass::hashType(CFTypeRef cf) throw()
+CFClass::hashType(CFTypeRef cf) _NOEXCEPT
 {
        try {
                return SecCFObject::optional(cf)->hash();
@@ -236,7 +189,7 @@ CFClass::hashType(CFTypeRef cf) throw()
 }
 
 CFStringRef
-CFClass::copyFormattingDescType(CFTypeRef cf, CFDictionaryRef dict) throw()
+CFClass::copyFormattingDescType(CFTypeRef cf, CFDictionaryRef dict) _NOEXCEPT
 {
        try {
                return SecCFObject::optional(cf)->copyFormattingDesc(dict);
@@ -246,7 +199,7 @@ CFClass::copyFormattingDescType(CFTypeRef cf, CFDictionaryRef dict) throw()
 }
 
 CFStringRef
-CFClass::copyDebugDescType(CFTypeRef cf) throw()
+CFClass::copyDebugDescType(CFTypeRef cf) _NOEXCEPT
 {
        try {
                return SecCFObject::optional(cf)->copyDebugDesc();