(Apple) Cleanups

This commit is contained in:
Twinaphex 2015-04-18 21:52:45 +02:00
parent a642092cb5
commit 6bbe6203a6

View File

@ -146,13 +146,16 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
static void frontend_apple_get_name(char *name, size_t sizeof_name) static void frontend_apple_get_name(char *name, size_t sizeof_name)
{ {
#ifdef IOS #if defined(IOS)
struct utsname buffer; struct utsname buffer;
if (uname(&buffer) != 0) if (uname(&buffer) != 0)
return; return;
strlcpy(name, buffer.machine, sizeof_name); strlcpy(name, buffer.machine, sizeof_name);
#elif defined(OSX)
size_t length = 0;
sysctlbyname("hw.model", name, &length, NULL, 0);
#endif #endif
} }
@ -163,9 +166,11 @@ static void frontend_apple_get_os(char *name, size_t sizeof_name, int *major, in
(void)major; (void)major;
(void)minor; (void)minor;
#ifdef IOS #if defined(IOS)
get_ios_version(major, minor); get_ios_version(major, minor);
strlcpy(name, "iOS", sizeof_name); strlcpy(name, "iOS", sizeof_name);
#elif defined(OSX)
strlcpy(name, "OSX", sizeof_name);
#endif #endif
} }