]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9925 Fix some ancient #ifdef checks
authorConnor Smith <connor.smith@hitachivantara.com>
Mon, 3 Oct 2022 10:11:10 +0000 (11:11 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 13 Oct 2022 16:01:57 +0000 (16:01 +0000)
Use #elif defined(...) for HAVE_WINSOCK and MACOS. All other instances
of these macros use #ifdef or similar. A compiler may warn about them
not being defined.

In libraries/liblber/sockbuf.c, (DOS && PCNFS) and (DOS && NCSA) were
replaced with HAVE_PCNFS and HAVE_NCSA, respectively. It seems logical
to do the same at the only remaining occurrence of DOS, PCNFS, and NCSA.

Use #if HARDCODE_DATA consistently, replacing two instances of #ifdef.
HARDCODE_DATA is always defined, and this way you can set HARDCODE_DATA
to 0 and have it work, rather than it going down the wrong branch and
failing in these two cases.

include/ac/socket.h
libraries/liblunicode/ucdata/ucgendat.c

index 38990136cf864b8dc93c2f2fb3b598cf2dbbdada..96ebabe06335b61fda7807cef9ad636e437fec06 100644 (file)
@@ -63,7 +63,7 @@
 #ifdef HAVE_WINSOCK2
 #include <winsock2.h>
 #include <ws2tcpip.h>
-#elif HAVE_WINSOCK
+#elif defined(HAVE_WINSOCK)
 #include <winsock.h>
 #endif
 
 
 LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int));
 
-#elif MACOS
+#elif defined(MACOS)
 #      define tcp_close( s )           tcpclose( s )
 #      define tcp_read( s, buf, len )  tcpread( s, buf, len )
 #      define tcp_write( s, buf, len ) tcpwrite( s, buf, len )
 
-#elif DOS
-#      ifdef PCNFS
-#              define tcp_close( s )   close( s )
-#              define tcp_read( s, buf, len )  recv( s, buf, len, 0 )
-#              define tcp_write( s, buf, len ) send( s, buf, len, 0 )
-#      endif /* PCNFS */
-#      ifdef NCSA
-#              define tcp_close( s )   do { netclose( s ); netshut() } while(0)
-#              define tcp_read( s, buf, len )  nread( s, buf, len )
-#              define tcp_write( s, buf, len ) netwrite( s, buf, len )
-#      endif /* NCSA */
+#elif defined(HAVE_PCNFS)
+#      define tcp_close( s )   close( s )
+#      define tcp_read( s, buf, len )  recv( s, buf, len, 0 )
+#      define tcp_write( s, buf, len ) send( s, buf, len, 0 )
+
+#elif defined(HAVE_NCSA)
+#      define tcp_close( s )   do { netclose( s ); netshut() } while(0)
+#      define tcp_read( s, buf, len )  nread( s, buf, len )
+#      define tcp_write( s, buf, len ) netwrite( s, buf, len )
 
 #elif defined(HAVE_CLOSESOCKET)
 #      define tcp_close( s )           closesocket( s )
index 6187756d86710bff61045f0b3a3280aef67072e2..305aed04e4427b56dea48504a39a743c1540c2f1 100644 (file)
@@ -1655,7 +1655,7 @@ write_cdata(char *opath)
     }
 #endif
 
-#ifdef HARDCODE_DATA
+#if HARDCODE_DATA
     fprintf(out, PREF "ac_uint4 _uckdcmp_size = %ld;\n\n",
         kdecomps_used * 2L);
 
@@ -1753,7 +1753,7 @@ write_cdata(char *opath)
      * Generate the combining class data.
      *
      *****************************************************************/
-#ifdef HARDCODE_DATA
+#if HARDCODE_DATA
     fprintf(out, PREF "ac_uint4 _uccmcl_size = %ld;\n\n", (long) ccl_used);
 
     fprintf(out, PREF "ac_uint4 _uccmcl_nodes[] = {");