[libxml2] Remove useless __CYGWIN__ checks



commit 2489c1d024906d0f72bbcf709aeb53a24602c219
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Feb 28 22:42:10 2022 +0100

    Remove useless __CYGWIN__ checks
    
    From what I can tell, some really early Cygwin versions from around
    1998-2000 used to erroneously define _WIN32. This was eventually fixed,
    but these days, the `defined(_WIN32) && !defined(__CYGWIN__)` idiom is
    unnecessary.
    
    Now, we only check for __CYGWIN__ in xmlexports.h when deciding whether
    to use __declspec.

 include/libxml/nanoftp.h |  2 +-
 nanoftp.c                |  2 +-
 nanohttp.c               |  2 +-
 parser.c                 |  2 +-
 parserInternals.c        |  2 +-
 runsuite.c               |  4 ++--
 runtest.c                | 10 +++++-----
 runxmlconf.c             |  4 ++--
 testHTML.c               |  6 +++---
 testSAX.c                |  4 ++--
 testlimits.c             |  2 +-
 testrecurse.c            |  6 +++---
 uri.c                    |  6 +++---
 xmlIO.c                  | 42 +++++++++++++++++++++---------------------
 xmllint.c                |  6 +++---
 xmlmodule.c              |  2 +-
 16 files changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/include/libxml/nanoftp.h b/include/libxml/nanoftp.h
index 37f47d77..f39bde5b 100644
--- a/include/libxml/nanoftp.h
+++ b/include/libxml/nanoftp.h
@@ -17,7 +17,7 @@
 #ifdef LIBXML_FTP_ENABLED
 
 /* Needed for portability to Windows 64 bits */
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 #include <winsock2.h>
 #else
 /**
diff --git a/nanoftp.c b/nanoftp.c
index 93ad0fc9..bfc77b60 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -75,7 +75,7 @@
 #endif
 
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 #include <wsockcompat.h>
 #endif
 
diff --git a/nanohttp.c b/nanohttp.c
index a4e5fd3d..0d0e74f8 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -73,7 +73,7 @@
 #define XML_SOCKLEN_T unsigned int
 #endif
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 #include <wsockcompat.h>
 #endif
 
diff --git a/parser.c b/parser.c
index 5384e556..54c5b0c2 100644
--- a/parser.c
+++ b/parser.c
@@ -38,7 +38,7 @@
 #define IN_LIBXML
 #include "libxml.h"
 
-#if defined(_WIN32) && !defined (__CYGWIN__)
+#if defined(_WIN32)
 #define XML_DIR_SEP '\\'
 #else
 #define XML_DIR_SEP '/'
diff --git a/parserInternals.c b/parserInternals.c
index 270270b2..1421681c 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -10,7 +10,7 @@
 #define IN_LIBXML
 #include "libxml.h"
 
-#if defined(_WIN32) && !defined (__CYGWIN__)
+#if defined(_WIN32)
 #define XML_DIR_SEP '\\'
 #else
 #define XML_DIR_SEP '/'
diff --git a/runsuite.c b/runsuite.c
index d24b5ec3..f7957ce1 100644
--- a/runsuite.c
+++ b/runsuite.c
@@ -9,7 +9,7 @@
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32) || defined(__CYGWIN__)
+#if !defined(_WIN32)
 #include <unistd.h>
 #endif
 #include <string.h>
@@ -48,7 +48,7 @@ static int checkTestFile(const char *filename) {
     if (stat(filename, &buf) == -1)
         return(0);
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     if (!(buf.st_mode & _S_IFREG))
         return(0);
 #else
diff --git a/runtest.c b/runtest.c
index 0754fe8d..26443485 100644
--- a/runtest.c
+++ b/runtest.c
@@ -14,7 +14,7 @@
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32) || defined(__CYGWIN__)
+#if !defined(_WIN32)
 #include <unistd.h>
 #endif
 #include <string.h>
@@ -108,7 +108,7 @@ static int update_results = 0;
 static char* temp_directory = NULL;
 static int checkTestFile(const char *filename);
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 
 #include <windows.h>
 #include <io.h>
@@ -599,7 +599,7 @@ static int checkTestFile(const char *filename) {
     if (stat(filename, &buf) == -1)
         return(0);
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     if (!(buf.st_mode & _S_IFREG))
         return(0);
 #else
@@ -4105,7 +4105,7 @@ thread_specific_data(void *private_data)
     return(NULL);
 }
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 #include <windows.h>
 #include <string.h>
 
@@ -4631,7 +4631,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
     int i, a, ret = 0;
     int subset = 0;
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     setvbuf(stdout, NULL, _IONBF, 0);
     setvbuf(stderr, NULL, _IONBF, 0);
 #endif
diff --git a/runxmlconf.c b/runxmlconf.c
index 8a37aa8f..7196c28a 100644
--- a/runxmlconf.c
+++ b/runxmlconf.c
@@ -11,7 +11,7 @@
 
 #ifdef LIBXML_XPATH_ENABLED
 
-#if !defined(_WIN32) || defined(__CYGWIN__)
+#if !defined(_WIN32)
 #include <unistd.h>
 #endif
 #include <string.h>
@@ -53,7 +53,7 @@ static int checkTestFile(const char *filename) {
     if (stat(filename, &buf) == -1)
         return(0);
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     if (!(buf.st_mode & _S_IFREG))
         return(0);
 #else
diff --git a/testHTML.c b/testHTML.c
index 9b42778c..3fa7319b 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -627,7 +627,7 @@ parseSAXFile(char *filename) {
     if (push) {
        FILE *f;
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
        f = fopen(filename, "rb");
 #else
        f = fopen(filename, "r");
@@ -657,7 +657,7 @@ parseSAXFile(char *filename) {
            fclose(f);
        }
        if (!noout) {
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
                f = fopen(filename, "rb");
 #else
                f = fopen(filename, "r");
@@ -721,7 +721,7 @@ parseAndPrintFile(char *filename) {
     if (push) {
        FILE *f;
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
        f = fopen(filename, "rb");
 #else
        f = fopen(filename, "r");
diff --git a/testSAX.c b/testSAX.c
index 81c4b93d..36816a89 100644
--- a/testSAX.c
+++ b/testSAX.c
@@ -1012,7 +1012,7 @@ parseAndPrintFile(char *filename) {
            /*
             * Empty callbacks for checking
             */
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
            f = fopen(filename, "rb");
 #else
            f = fopen(filename, "r");
@@ -1041,7 +1041,7 @@ parseAndPrintFile(char *filename) {
        /*
         * Debug callback
         */
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
        f = fopen(filename, "rb");
 #else
        f = fopen(filename, "r");
diff --git a/testlimits.c b/testlimits.c
index 059116a6..0b045eac 100644
--- a/testlimits.c
+++ b/testlimits.c
@@ -13,7 +13,7 @@
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32) || defined(__CYGWIN__)
+#if !defined(_WIN32)
 #include <unistd.h>
 #endif
 #include <string.h>
diff --git a/testrecurse.c b/testrecurse.c
index 0cbe25a6..fabc5138 100644
--- a/testrecurse.c
+++ b/testrecurse.c
@@ -13,7 +13,7 @@
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32) || defined(__CYGWIN__)
+#if !defined(_WIN32)
 #include <unistd.h>
 #endif
 #include <string.h>
@@ -56,7 +56,7 @@ struct testDesc {
 static int checkTestFile(const char *filename);
 
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 
 #include <windows.h>
 #include <io.h>
@@ -643,7 +643,7 @@ static int checkTestFile(const char *filename) {
     if (stat(filename, &buf) == -1)
         return(0);
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     if (!(buf.st_mode & _S_IFREG))
         return(0);
 #else
diff --git a/uri.c b/uri.c
index 81ec7f43..e5c790eb 100644
--- a/uri.c
+++ b/uri.c
@@ -2383,7 +2383,7 @@ xmlCanonicPath(const xmlChar *path)
  * For Windows implementations, additional work needs to be done to
  * replace backslashes in pathnames with "forward slashes"
  */
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     int len = 0;
     char *p = NULL;
 #endif
@@ -2455,7 +2455,7 @@ xmlCanonicPath(const xmlChar *path)
 
 path_processing:
 /* For Windows implementations, replace backslashes with 'forward slashes' */
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     /*
      * Create a URI structure
      */
@@ -2534,7 +2534,7 @@ xmlPathToURI(const xmlChar *path)
     cal = xmlCanonicPath(path);
     if (cal == NULL)
         return(NULL);
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
     /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?)
        If 'cal' is a valid URI already then we are done here, as continuing would make
        it invalid. */
diff --git a/xmlIO.c b/xmlIO.c
index c510a7e9..e71056aa 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -40,7 +40,7 @@
 #include <lzma.h>
 #endif
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
@@ -190,7 +190,7 @@ static const char *IOerr[] = {
     "unknown address family",  /* EAFNOSUPPORT */
 };
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
 /**
  * __xmlIOWin32UTF8ToWChar:
  * @u8String:  uft-8 string
@@ -595,7 +595,7 @@ xmlPopOutputCallbacks(void)
  *                                                                     *
  ************************************************************************/
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
 
 /**
  *  xmlWrapOpenUtf8:
@@ -696,7 +696,7 @@ int
 xmlCheckFilename (const char *path)
 {
 #ifdef HAVE_STAT
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
     struct _stat stat_buffer;
 #else
     struct stat stat_buffer;
@@ -706,7 +706,7 @@ xmlCheckFilename (const char *path)
        return(0);
 
 #ifdef HAVE_STAT
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
     /*
      * On Windows stat and wstat do not work with long pathname,
      * which start with '\\?\'
@@ -837,20 +837,20 @@ xmlFileOpen_real (const char *filename) {
     }
 
     if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) {
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[17];
 #else
        path = &filename[16];
 #endif
     } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[8];
 #else
        path = &filename[7];
 #endif
     } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:/", 6)) {
         /* lots of generators seems to lazy to read RFC 1738 */
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[6];
 #else
        path = &filename[5];
@@ -863,7 +863,7 @@ xmlFileOpen_real (const char *filename) {
         return(NULL);
 #endif
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
     fd = xmlWrapOpenUtf8(path, 0);
 #else
     fd = fopen(path, "r");
@@ -919,13 +919,13 @@ xmlFileOpenW (const char *filename) {
     }
 
     if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[17];
 #else
        path = &filename[16];
 #endif
     else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[8];
 #else
        path = &filename[7];
@@ -936,7 +936,7 @@ xmlFileOpenW (const char *filename) {
     if (path == NULL)
        return(NULL);
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
     fd = xmlWrapOpenUtf8(path, 1);
 #elif(__MVS__)
     fd = fopen(path, "w");
@@ -1109,13 +1109,13 @@ xmlGzfileOpen_real (const char *filename) {
     }
 
     if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[17];
 #else
        path = &filename[16];
 #endif
     else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[8];
 #else
        path = &filename[7];
@@ -1128,7 +1128,7 @@ xmlGzfileOpen_real (const char *filename) {
     if (!xmlCheckFilename(path))
         return(NULL);
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
     fd = xmlWrapGzOpenUtf8(path, "rb");
 #else
     fd = gzopen(path, "rb");
@@ -1188,13 +1188,13 @@ xmlGzfileOpenW (const char *filename, int compression) {
     }
 
     if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[17];
 #else
        path = &filename[16];
 #endif
     else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &filename[8];
 #else
        path = &filename[7];
@@ -1205,7 +1205,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
     if (path == NULL)
        return(NULL);
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
     fd = xmlWrapGzOpenUtf8(path, mode);
 #else
     fd = gzopen(path, mode);
@@ -3774,7 +3774,7 @@ xmlParserGetDirectory(const char *filename) {
 
     if (filename == NULL) return(NULL);
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 #   define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\'))
 #else
 #   define IS_XMLPGD_SEP(ch) (ch=='/')
@@ -3891,13 +3891,13 @@ static int xmlNoNetExists(const char *URL) {
        return(0);
 
     if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &URL[17];
 #else
        path = &URL[16];
 #endif
     else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
+#if defined (_WIN32) || defined (__DJGPP__)
        path = &URL[8];
 #else
        path = &URL[7];
diff --git a/xmllint.c b/xmllint.c
index b314189f..ef25c052 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -2202,7 +2202,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
         if ((filename[0] == '-') && (filename[1] == 0)) {
             f = stdin;
         } else {
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
            f = fopen(filename, "rb");
 #elif defined(__OS400__)
            f = fopen(filename, "rb");
@@ -2278,7 +2278,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
            if ((filename[0] == '-') && (filename[1] == 0)) {
              f = stdin;
            } else {
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
                f = fopen(filename, "rb");
 #elif defined(__OS400__)
                f = fopen(filename, "rb");
@@ -2327,7 +2327,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
            } else {
                FILE *f;
 
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+#if defined(_WIN32) || defined (__DJGPP__)
                f = fopen(filename, "rb");
 #elif defined(__OS400__)
                f = fopen(filename, "rb");
diff --git a/xmlmodule.c b/xmlmodule.c
index 82bf1339..592c1c7e 100644
--- a/xmlmodule.c
+++ b/xmlmodule.c
@@ -301,7 +301,7 @@ xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
 #endif /* HAVE_SHLLOAD */
 #endif /* ! HAVE_DLOPEN */
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32)
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]