From: Connor Smith Date: Mon, 3 Oct 2022 10:11:10 +0000 (+0100) Subject: ITS#9925 Fix some ancient #ifdef checks X-Git-Tag: OPENLDAP_REL_ENG_2_5_14~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acf30be29af90f07e8f79f0137716df62403c670;p=thirdparty%2Fopenldap.git ITS#9925 Fix some ancient #ifdef checks 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. --- diff --git a/include/ac/socket.h b/include/ac/socket.h index 38990136cf..96ebabe063 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -63,7 +63,7 @@ #ifdef HAVE_WINSOCK2 #include #include -#elif HAVE_WINSOCK +#elif defined(HAVE_WINSOCK) #include #endif @@ -111,22 +111,20 @@ 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 ) diff --git a/libraries/liblunicode/ucdata/ucgendat.c b/libraries/liblunicode/ucdata/ucgendat.c index 6187756d86..305aed04e4 100644 --- a/libraries/liblunicode/ucdata/ucgendat.c +++ b/libraries/liblunicode/ucdata/ucgendat.c @@ -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[] = {");