macOS: don't keep variable matchDict

This commit is contained in:
李通洲
2023-10-07 15:51:05 +08:00
parent 3077f885d8
commit 90ea096ca3
7 changed files with 7 additions and 29 deletions
+1 -5
View File
@@ -140,12 +140,8 @@ static const char *smcReadSmcVal(io_connect_t conn, const UInt32Char_t key, SmcV
static const char *smcOpen(io_connect_t *conn)
{
CFMutableDictionaryRef matchDict = IOServiceMatching("AppleSMC");
if (matchDict == NULL)
return "IOServiceMatching(\"AppleSmartBattery\") failed";
io_iterator_t iterator;
if (IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) != kIOReturnSuccess)
if (IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("AppleSMC"), &iterator) != kIOReturnSuccess)
return "IOServiceGetMatchingServices() failed";
io_object_t device = IOIteratorNext(iterator);