]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOCommandGate.cpp
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / iokit / Kernel / IOCommandGate.cpp
index 1ae9bcf0880b1b9610128e2a300943147e57de8a..1404aac5a3f84f7c2e23780e7842b35001b5f06b 100644 (file)
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
+
+#define IOKIT_ENABLE_SHARED_PTR
+
 #include <libkern/OSDebug.h>
+#include <libkern/c++/OSSharedPtr.h>
 
 #include <IOKit/IOCommandGate.h>
 #include <IOKit/IOWorkLoop.h>
 
 #define super IOEventSource
 
-OSDefineMetaClassAndStructors(IOCommandGate, IOEventSource)
+OSDefineMetaClassAndStructorsWithZone(IOCommandGate, IOEventSource, ZC_NONE)
 #if __LP64__
 OSMetaClassDefineReservedUnused(IOCommandGate, 0);
 #else
-OSMetaClassDefineReservedUsed(IOCommandGate, 0);
+OSMetaClassDefineReservedUsedX86(IOCommandGate, 0);
 #endif
 OSMetaClassDefineReservedUnused(IOCommandGate, 1);
 OSMetaClassDefineReservedUnused(IOCommandGate, 2);
@@ -79,14 +83,13 @@ IOCommandGate::init(OSObject *inOwner, Action inAction)
        return res;
 }
 
-IOCommandGate *
+OSSharedPtr<IOCommandGate>
 IOCommandGate::commandGate(OSObject *inOwner, Action inAction)
 {
-       IOCommandGate *me = new IOCommandGate;
+       OSSharedPtr<IOCommandGate> me = OSMakeShared<IOCommandGate>();
 
        if (me && !me->init(inOwner, inAction)) {
-               me->release();
-               return NULL;
+               return nullptr;
        }
 
        return me;