Loading...
libkern/c++/OSCollection.cpp xnu-12377.101.15 xnu-6153.41.3
--- xnu/xnu-12377.101.15/libkern/c++/OSCollection.cpp
+++ xnu/xnu-6153.41.3/libkern/c++/OSCollection.cpp
@@ -27,8 +27,6 @@
  */
 /* IOArray.h created by rsulack on Thu 11-Sep-1997 */
 
-#define IOKIT_ENABLE_SHARED_PTR
-
 #include <libkern/OSDebug.h>
 
 #include <libkern/c++/OSCollection.h>
@@ -41,8 +39,8 @@
 OSDefineMetaClassAndAbstractStructors(OSCollection, OSObject)
 
 
-OSMetaClassDefineReservedUsedX86(OSCollection, 0);
-OSMetaClassDefineReservedUsedX86(OSCollection, 1);
+OSMetaClassDefineReservedUsed(OSCollection, 0);
+OSMetaClassDefineReservedUsed(OSCollection, 1);
 OSMetaClassDefineReservedUnused(OSCollection, 2);
 OSMetaClassDefineReservedUnused(OSCollection, 3);
 OSMetaClassDefineReservedUnused(OSCollection, 4);
@@ -87,19 +85,23 @@
 	return old;
 }
 
-OSSharedPtr<OSCollection>
+OSCollection *
 OSCollection::copyCollection(OSDictionary *cycleDict)
 {
 	if (cycleDict) {
 		OSObject *obj = cycleDict->getObject((const OSSymbol *) this);
+		if (obj) {
+			obj->retain();
+		}
 
-		return OSSharedPtr<OSCollection>(reinterpret_cast<OSCollection *>(obj), OSRetain);
+		return reinterpret_cast<OSCollection *>(obj);
 	} else {
 		// If we are here it means that there is a collection subclass that
 		// hasn't overridden the copyCollection method.  In which case just
 		// return a reference to ourselves.
 		// Hopefully this collection will not be inserted into the registry
-		return OSSharedPtr<OSCollection>(this, OSRetain);
+		retain();
+		return this;
 	}
 }