]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Use _WIN32 instead of WIN32 preprocessor macro
authorWolfgang Stöggl <c72578@yahoo.de>
Sat, 19 Jan 2019 22:41:02 +0000 (23:41 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Sun, 20 Jan 2019 15:19:06 +0000 (16:19 +0100)
- _WIN32 is the recommended preprocessor macro
- Substitute occurrences of WIN32 with _WIN32 using:
git grep -lw -e '#ifdef WIN32' -e '#ifndef WIN32' -e 'defined(WIN32)' \
-- '*.c' '*.h' '*.xs' | xargs \
sed -i -e 's/#ifdef WIN32/#ifdef _WIN32/g' \
-e 's/#ifndef WIN32/#ifndef _WIN32/g' \
-e 's/defined(WIN32)/defined(_WIN32)/g'

17 files changed:
bindings/perl-shared/RRDs.xs
src/mutex.c
src/mutex.h
src/plbasename.c
src/plbasename.h
src/rrd.h
src/rrd_client.c
src/rrd_create.c
src/rrd_daemon.c
src/rrd_dump.c
src/rrd_format.c
src/rrd_graph.c
src/rrd_modify.c
src/rrd_open.c
src/rrd_restore.c
src/rrd_tool.c
src/rrd_utils.c

index 9c3531b739121b73e5e41ef3f41f4e5072069416..e233b5835de0e08e9850c05302dd50230507c475 100644 (file)
@@ -24,7 +24,7 @@ extern "C" {
  */
 #define VERSION_SAVED VERSION
 #undef VERSION
-#ifndef WIN32
+#ifndef _WIN32
 #include "rrd_config.h"
 #endif
 #include "rrd_tool.h"
@@ -105,7 +105,7 @@ extern "C" {
 
 /*
  * should not be needed if libc is linked (see ntmake.pl)
-#ifdef WIN32
+#ifdef _WIN32
  #define free free
  #define malloc malloc
  #define realloc realloc
index c359b6fc1182f7e72b7c7ba3a6b0a68a452a9998..95514129a4c90380d94d3a2945f7fb05bda94ea7 100644 (file)
@@ -10,7 +10,7 @@
 
 int mutex_init(mutex_t *mutex)
 {
-#ifdef WIN32
+#ifdef _WIN32
   *mutex = CreateMutex(NULL, FALSE, NULL);
   return (*mutex == NULL);
 #else
@@ -20,7 +20,7 @@ int mutex_init(mutex_t *mutex)
 
 int mutex_lock(mutex_t *mutex)
 {
-#ifdef WIN32
+#ifdef _WIN32
   if (*mutex == NULL) { /* static initializer? */
     HANDLE p = CreateMutex(NULL, FALSE, NULL);
     if (InterlockedCompareExchangePointer((PVOID*)mutex, (PVOID)p, NULL) != NULL)
@@ -34,7 +34,7 @@ int mutex_lock(mutex_t *mutex)
 
 int mutex_unlock(mutex_t *mutex)
 {
-#ifdef WIN32
+#ifdef _WIN32
   return (ReleaseMutex(*mutex) == 0);
 #else
   return pthread_mutex_unlock(mutex);
@@ -43,7 +43,7 @@ int mutex_unlock(mutex_t *mutex)
 
 int mutex_cleanup(mutex_t *mutex)
 {
-#ifdef WIN32
+#ifdef _WIN32
   return (CloseHandle(mutex) == 0);
 #else
   return pthread_mutex_destroy(mutex);
index 17664db8c5d76b06e330685179150847316484ee..4d7c43caea5dccebc99ee37d19807b0bf1c5cac2 100644 (file)
@@ -5,14 +5,14 @@
 #ifndef MUTEX_H_B13C67AB432C4C39AF823A339537CA40
 #define MUTEX_H_B13C67AB432C4C39AF823A339537CA40
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <windows.h>
 #include <process.h>
 #else
 #include <pthread.h>
 #endif
 
-#ifndef WIN32
+#ifndef _WIN32
 #define mutex_t            pthread_mutex_t
 #define MUTEX_INITIALIZER  PTHREAD_MUTEX_INITIALIZER
 #else
index cd114d26fae42fd070f6136c854b95b050f05f7a..55d44fb7f0a2ef0f47666ee65cd5ef343cc82660 100644 (file)
@@ -1,4 +1,4 @@
-#ifdef WIN32
+#ifdef _WIN32
 /*
  *
  * Cross-platform basename/dirname 
index 28786a11c1266d8bc9c5c3c516febce5c6330df0..31f8879c552eff33bf86cd833ab6c01b2513735b 100644 (file)
@@ -1,4 +1,4 @@
-#ifdef WIN32
+#ifdef _WIN32
 /*
  *
  * Cross-platform basename/dirname
index 0fb5f072490205896ae8dd3dfea5198ee2f7ddb7..1f6199c95d605085f311ec86d63b3feb6d49c0b2 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
@@ -54,7 +54,7 @@ extern    "C" {
 
 #include <sys/types.h>  /* for off_t */
 
-#ifndef WIN32
+#ifndef _WIN32
 #include <unistd.h>     /* for off_t */
 #else
 #ifdef _MSC_VER
@@ -345,7 +345,7 @@ struct rrd_t;
 /* returns the current per-thread rrd_context */
     rrd_context_t *rrd_get_context(void);
 
-#ifdef WIN32
+#ifdef _WIN32
 /* this was added by the win32 porters Christof.Wegmann@exitgames.com */
     rrd_context_t *rrd_force_new_context(void);
 #endif
index 2b5b6f7b896806a9bfd7520920da15c077a5a1f4..ed64863889845c277e00502e6615e0ca3edfb5d6 100644 (file)
@@ -25,7 +25,7 @@
  *   Sebastian tokkee Harl <sh at tokkee.org>
  **/
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <ws2tcpip.h> // contain #include <winsock2.h>
 // Need to link with Ws2_32.lib
@@ -53,7 +53,7 @@
 #include <string.h>
 #include <errno.h>
 #include <assert.h>
-#ifndef WIN32
+#ifndef _WIN32
 #include <strings.h>
 #include <pthread.h>
 #include <sys/socket.h>
@@ -342,7 +342,7 @@ static int parse_value_array_header (char *line, /* {{{ */
 static void close_socket(rrd_client_t *client)
 {
   if (client->sd >= 0) {
-#ifdef WIN32
+#ifdef _WIN32
     closesocket(client->sd);
     WSACleanup();
 #else
@@ -743,7 +743,7 @@ int rrdc_ping(void) /* {{{ */
 
 static int connect_unix(rrd_client_t *client, const char *path) /* {{{ */
 {
-#ifdef WIN32
+#ifdef _WIN32
   return (WSAEPROTONOSUPPORT);
 #else
   struct sockaddr_un sa;
@@ -835,7 +835,7 @@ static int connect_network(rrd_client_t *client, const char *addr_orig) /* {{{ *
     }
   }
 
-#ifdef WIN32
+#ifdef _WIN32
   WORD wVersionRequested;
   WSADATA wsaData;
 
index 32e9ce2fa61047fc26bcc718b82ef3716087014b..d2d372baaf92536adb5a9d9e36895a8381942d52 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "unused.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 # include <process.h>
 #endif
 
@@ -1461,7 +1461,7 @@ int write_rrd(
                WILL NOT take care of any ACLs that may be set. Go
                figure. */
             if (stat(outfilename, &stat_buf) != 0) {
-#ifdef WIN32
+#ifdef _WIN32
                 stat_buf.st_mode = _S_IREAD | _S_IWRITE;    // have to test it is 
 #else
                 /* an error occurred (file not found, maybe?). Anyway:
@@ -1481,7 +1481,7 @@ int write_rrd(
                 rrd_clear_error();
             }
 
-#ifdef WIN32
+#ifdef _WIN32
 /* In Windows, renaming to an existing file is not allowed. Even, if the file
  * is deleted before, using _unlink() here. Furthermore the FILE_SHARE_DELETE
  * flag is required, which is used in CreateFileA in rrd_open.c
index 02cd0520c72fc03c51192c6ee689387c5ca7eeb6..54a4ec04a1b456ebe64e7ad567450521413f68e0 100644 (file)
@@ -73,7 +73,7 @@
 #  include <stdint.h>
 #endif
 
-#ifndef WIN32
+#ifndef _WIN32
 #include <unistd.h>
 #include <strings.h>
 #include <inttypes.h>
index 514328ab68a3ecb3a836191f04ad8ed80ec3480e..12b24297af84304c8f1d1d8791c78ac8d3c64683 100644 (file)
@@ -47,7 +47,7 @@
 #include "rrd_snprintf.h"
 
 
-#if !(defined(NETWARE) || defined(WIN32))
+#if !(defined(NETWARE) || defined(_WIN32))
 extern char *tzname[2];
 #endif
 
index 32a051a2aedcd0a6fc6238c202b45234e36f66bb..678ffc3dd195c15ca67405284d78517a0c54e9bd 100644 (file)
@@ -4,7 +4,7 @@
  * rrd_format.c  RRD Database Format helper functions
  *****************************************************************************/
 #include "rrd_tool.h"
-#ifdef WIN32
+#ifdef _WIN32
 #include "stdlib.h"
 #endif
 
index 8a6be0d75554b3d1b462370dabb978ba3c208c2c..bf8ffde89abc8bc911cb839c8b9611f8cc6caaf6 100644 (file)
@@ -9,7 +9,7 @@
 
 
 
-#if defined(WIN32) && !defined(__MINGW32__)
+#if defined(_WIN32) && !defined(__MINGW32__)
 #include "strftime.h"
 #endif
 
@@ -37,7 +37,7 @@
 #include "plbasename.h"
 #endif
 
-#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
 #include <io.h>
 #include <fcntl.h>
 #endif
index 674d7db5ba1c520b45b690ac3c06d55d3ac1fad6..f40dd5fa84e82db6963ba798a8bb0ad5ba8cc7c8 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <locale.h>
 #include "rrd_config.h"
-#ifdef WIN32
+#ifdef _WIN32
 #include <stdlib.h>
 #include <fcntl.h>
 #include <sys/stat.h>
index d02acfe27a681cca60f80de617f2f6a5980ffaef..9daee757d6d3884cf9796d74aa6929f93a24b8a8 100644 (file)
@@ -6,7 +6,7 @@
  * $Id$
  *****************************************************************************/
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <windows.h>
 #if _WIN32_MAXVER >= 0x0602 /* _WIN32_WINNT_WIN8 */
 #include <synchapi.h>
@@ -33,7 +33,7 @@
 
 #define MEMBLK 8192
 
-#ifdef WIN32
+#ifdef _WIN32
 #define        _LK_UNLCK       0   /* Unlock */
 #define        _LK_LOCK        1   /* Lock */
 #define        _LK_NBLCK       2   /* Non-blocking lock */
index 1afe753dd651e915c9afd7d6651fb73ceb776803..b4df93cd0a95892894b10b4b75345b83a513fc9b 100644 (file)
@@ -23,7 +23,7 @@
 #include <libxml/xmlreader.h>
 #include <locale.h>
 
-#ifndef WIN32
+#ifndef _WIN32
 #      include <unistd.h>     /* for off_t */
 #else
 #ifndef __MINGW32__     /* MinGW-w64 has ssize_t and off_t */
index e6831b88e9fd0810e4b48a9642e973238c4be9df..4a01760dada12da8525df99f3b85b22d09b719f4 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "rrd_config.h"
 
-#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <io.h>
@@ -449,7 +449,7 @@ int main(
        according to localeconv(3) */       
     setlocale(LC_ALL, "");
 
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
     setmode(fileno(stdout), O_BINARY);
     setmode(fileno(stdin), O_BINARY);
 #endif
index f26be8cce756d7fc550604baa9c65f85bd5fa945..cd0f80b0d9eb2c9ff96892ff556c62b371ae54aa 100644 (file)
@@ -34,7 +34,7 @@
 #include <libgen.h>
 #include <unistd.h>
 #endif
-#ifdef WIN32
+#ifdef _WIN32
 #      define random() rand()
 #      define srandom(x) srand(x)
 #      define getpid() 0