aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-03-05 19:53:47 +0100
committerMattias Andrée <m@maandree.se>2025-03-05 19:53:47 +0100
commit066fac61e017824f7dccbd1ef3d7dc455cf4b95b (patch)
treeb240eee9ec49ab3b83fe4978d3a0472def7251ce
parentMerge config-ini.h and options.h into common.h (diff)
downloadredshift-ng-066fac61e017824f7dccbd1ef3d7dc455cf4b95b.tar.gz
redshift-ng-066fac61e017824f7dccbd1ef3d7dc455cf4b95b.tar.bz2
redshift-ng-066fac61e017824f7dccbd1ef3d7dc455cf4b95b.tar.xz
Consistently use (locally defined) WINDOWS macro over mixing __WIN32__ and _WIN32
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r--src/common.h8
-rw-r--r--src/config-ini.c4
-rw-r--r--src/hooks.c4
-rw-r--r--src/redshift.c6
-rw-r--r--src/signals.c2
5 files changed, 12 insertions, 12 deletions
diff --git a/src/common.h b/src/common.h
index 746238d..e63e15b 100644
--- a/src/common.h
+++ b/src/common.h
@@ -249,12 +249,12 @@ void pipeutils_signal(int write_fd);
void pipeutils_handle_signal(int read_fd);
-#if !defined(__WIN32__)
-extern volatile sig_atomic_t exiting;
-extern volatile sig_atomic_t disable;
-#else
+#ifdef WINDOWS
extern int exiting;
extern int disable;
+#else
+extern volatile sig_atomic_t exiting;
+extern volatile sig_atomic_t disable;
#endif
int signals_install_handlers(void);
diff --git a/src/config-ini.c b/src/config-ini.c
index 2041db5..89d55d5 100644
--- a/src/config-ini.c
+++ b/src/config-ini.c
@@ -54,7 +54,7 @@ open_config_file(const char *filepath)
}
}
-#ifdef _WIN32
+#ifdef WINDOWS
if (f == NULL && (env = getenv("localappdata")) != NULL &&
env[0] != '\0') {
snprintf(cp, sizeof(cp),
@@ -74,7 +74,7 @@ open_config_file(const char *filepath)
f = fopen(cp, "r");
}
}
-#ifndef _WIN32
+#ifndef WINDOWS
if (f == NULL) {
struct passwd *pwd = getpwuid(getuid());
diff --git a/src/hooks.c b/src/hooks.c
index 1bd3efe..485f5f0 100644
--- a/src/hooks.c
+++ b/src/hooks.c
@@ -50,7 +50,7 @@ open_hooks_dir(char *hp)
return opendir(hp);
}
-#ifndef _WIN32
+#ifndef WINDOWS
struct passwd *pwd = getpwuid(getuid());
snprintf(hp, MAX_HOOK_PATH, "%s/.config/redshift/hooks", pwd->pw_dir);
return opendir(hp);
@@ -77,7 +77,7 @@ hooks_signal_period_change(enum period prev_period, enum period period)
snprintf(hook_path, sizeof(hook_path), "%s/%s",
hooksdir_path, hook_name);
-#ifndef _WIN32
+#ifndef WINDOWS
/* Fork and exec the hook. We close stdout
so the hook cannot interfere with the normal
output. */
diff --git a/src/redshift.c b/src/redshift.c
index b60236c..ca8e66b 100644
--- a/src/redshift.c
+++ b/src/redshift.c
@@ -22,7 +22,7 @@
/* poll.h is not available on Windows but there is no Windows location provider
using polling. On Windows, we just define some stubs to make things compile.
*/
-#ifndef _WIN32
+#ifndef WINDOWS
# include <poll.h>
#else
#define POLLIN 0
@@ -36,7 +36,7 @@ int poll(struct pollfd *fds, int nfds, int timeout) { abort(); return -1; }
/* pause() is not defined on windows platform but is not needed either.
Use a noop macro instead. */
-#ifdef __WIN32__
+#ifdef WINDOWS
# define pause()
#endif
@@ -144,7 +144,7 @@ get_seconds_since_midnight(double timestamp)
{
time_t t = (time_t)timestamp;
struct tm tm;
-#ifdef _WIN32
+#ifdef WINDOWS
localtime_s(&tm, &t);
#else
localtime_r(&t, &tm);
diff --git a/src/signals.c b/src/signals.c
index 70addf8..8c07b97 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -20,7 +20,7 @@
#include "common.h"
-#if !defined(__WIN32__)
+#ifndef WINDOWS
volatile sig_atomic_t exiting = 0;
volatile sig_atomic_t disable = 0;