summaryrefslogtreecommitdiff
path: root/Source/3rdParty/SDL2/src/power/SDL_power.c
diff options
context:
space:
mode:
Diffstat (limited to 'Source/3rdParty/SDL2/src/power/SDL_power.c')
-rw-r--r--Source/3rdParty/SDL2/src/power/SDL_power.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/3rdParty/SDL2/src/power/SDL_power.c b/Source/3rdParty/SDL2/src/power/SDL_power.c
index e09e27b..de77c09 100644
--- a/Source/3rdParty/SDL2/src/power/SDL_power.c
+++ b/Source/3rdParty/SDL2/src/power/SDL_power.c
@@ -42,11 +42,8 @@ SDL_GetPowerInfo_Hardwired(SDL_PowerState * state, int *seconds, int *percent)
return SDL_TRUE;
}
#endif
-#endif
-
static SDL_GetPowerInfo_Impl implementations[] = {
-#ifndef SDL_POWER_DISABLED
#ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */
SDL_GetPowerInfo_Linux_org_freedesktop_upower,
SDL_GetPowerInfo_Linux_sys_class_power_supply,
@@ -81,31 +78,34 @@ static SDL_GetPowerInfo_Impl implementations[] = {
#ifdef SDL_POWER_HARDWIRED
SDL_GetPowerInfo_Hardwired,
#endif
-#endif
};
+#endif
SDL_PowerState
SDL_GetPowerInfo(int *seconds, int *percent)
{
+#ifndef SDL_POWER_DISABLED
const int total = sizeof(implementations) / sizeof(implementations[0]);
- int _seconds, _percent;
SDL_PowerState retval = SDL_POWERSTATE_UNKNOWN;
int i;
+#endif
+ int _seconds, _percent;
/* Make these never NULL for platform-specific implementations. */
if (seconds == NULL) {
seconds = &_seconds;
}
-
if (percent == NULL) {
percent = &_percent;
}
+#ifndef SDL_POWER_DISABLED
for (i = 0; i < total; i++) {
if (implementations[i](&retval, seconds, percent)) {
return retval;
}
}
+#endif
/* nothing was definitive. */
*seconds = -1;