From: Amos Jeffries Date: Sun, 29 Sep 2013 20:14:10 +0000 (-0600) Subject: Fix various header build issues in librfcnb X-Git-Tag: SQUID_3_5_0_1~626 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9864722fd5efb4813cae6e8134d9f72b9bf84868;p=thirdparty%2Fsquid.git Fix various header build issues in librfcnb Highlighted when the #include sorting was applied to lib/rfcnb/ files several of the headers were using order-dependent definitions and were not wrapped with sfety macros. --- diff --git a/lib/rfcnb/rfcnb-common.h b/lib/rfcnb/rfcnb-common.h index 9f5828f27d..1ab2be37e6 100644 --- a/lib/rfcnb/rfcnb-common.h +++ b/lib/rfcnb/rfcnb-common.h @@ -26,7 +26,7 @@ #ifndef _RFCNB_RFCNB_COMMON_H #define _RFCNB_RFCNB_COMMON_H -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif @@ -40,8 +40,7 @@ extern "C" { } RFCNB_Pkt; -#ifdef __cplusplus +#if defined(__cplusplus) } - #endif -#endif /* _RFCNB_RFCNB_COMMON_H */ +#endif /* _RFCNB_RFCNB_COMMON_H */ diff --git a/lib/rfcnb/rfcnb-io.c b/lib/rfcnb/rfcnb-io.c index 66beb302f4..fea3b2829a 100644 --- a/lib/rfcnb/rfcnb-io.c +++ b/lib/rfcnb/rfcnb-io.c @@ -25,10 +25,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "rfcnb/std-includes.h" +#include "rfcnb/rfcnb-io.h" #include "rfcnb/rfcnb-priv.h" #include "rfcnb/rfcnb-util.h" -#include "rfcnb/rfcnb-io.h" +#include "rfcnb/std-includes.h" #include #include diff --git a/lib/rfcnb/rfcnb-io.h b/lib/rfcnb/rfcnb-io.h index 6b54e86e05..3019b0223a 100644 --- a/lib/rfcnb/rfcnb-io.h +++ b/lib/rfcnb/rfcnb-io.h @@ -1,3 +1,6 @@ +#ifndef _SQUID__LIB_RFCNB_RFCNB_IO_H +#define _SQUID__LIB_RFCNB_RFCNB_IO_H + /* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation * * Version 1.0 @@ -23,6 +26,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "rfcnb/rfcnb.h" + int RFCNB_Put_Pkt(struct RFCNB_Con *con, struct RFCNB_Pkt *pkt, int len); int RFCNB_Get_Pkt(struct RFCNB_Con *con, struct RFCNB_Pkt *pkt, int len); + +#endif diff --git a/lib/rfcnb/rfcnb-priv.h b/lib/rfcnb/rfcnb-priv.h index 31e9ce7b92..cf65eb1a69 100644 --- a/lib/rfcnb/rfcnb-priv.h +++ b/lib/rfcnb/rfcnb-priv.h @@ -32,9 +32,13 @@ typedef unsigned short uint16; #define GLOBAL extern -#include "rfcnb/rfcnb-error.h" -#include "rfcnb/rfcnb-common.h" #include "rfcnb/byteorder.h" +#include "rfcnb/rfcnb-common.h" +#include "rfcnb/rfcnb-error.h" + +#if HAVE_NETINET_IN_H +#include +#endif #ifdef RFCNB_PORT #define RFCNB_Default_Port RFCNB_PORT diff --git a/lib/rfcnb/rfcnb-util.c b/lib/rfcnb/rfcnb-util.c index eb6f29cec3..2fd4348923 100644 --- a/lib/rfcnb/rfcnb-util.c +++ b/lib/rfcnb/rfcnb-util.c @@ -25,11 +25,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "rfcnb/rfcnb.h" -#include "rfcnb/std-includes.h" +#include "rfcnb/rfcnb-io.h" #include "rfcnb/rfcnb-priv.h" #include "rfcnb/rfcnb-util.h" -#include "rfcnb/rfcnb-io.h" +#include "rfcnb/rfcnb.h" +#include "rfcnb/std-includes.h" #if HAVE_ARPA_INET_H #include diff --git a/lib/rfcnb/rfcnb-util.h b/lib/rfcnb/rfcnb-util.h index adf9ffa8e6..270857bce6 100644 --- a/lib/rfcnb/rfcnb-util.h +++ b/lib/rfcnb/rfcnb-util.h @@ -1,3 +1,6 @@ +#ifndef _RFCNB_RFCNB_UTIL_H +#define _RFCNB_RFCNB_UTIL_H + /* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation * * Version 1.0 @@ -23,6 +26,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "rfcnb/std-includes.h" + void RFCNB_CvtPad_Name(char *name1, char *name2); void RFCNB_AName_To_NBName(char *AName, char *NBName); @@ -48,3 +53,5 @@ int RFCNB_Session_Req(struct RFCNB_Con *con, typedef void RFCNB_Prot_Print_Routine(FILE * fd, int dir, struct RFCNB_Pkt *pkt, int header, int payload); extern RFCNB_Prot_Print_Routine *Prot_Print_Routine; + +#endif /* _RFCNB_RFCNB_UTIL_H */ diff --git a/lib/rfcnb/rfcnb.h b/lib/rfcnb/rfcnb.h index 1e4c3d9cb2..89cfb5787f 100644 --- a/lib/rfcnb/rfcnb.h +++ b/lib/rfcnb/rfcnb.h @@ -28,8 +28,8 @@ /* Error responses */ -#include "rfcnb/rfcnb-error.h" #include "rfcnb/rfcnb-common.h" +#include "rfcnb/rfcnb-error.h" #ifdef __cplusplus extern "C" { diff --git a/lib/rfcnb/session.c b/lib/rfcnb/session.c index b2d4246ea5..35ca1c2e42 100644 --- a/lib/rfcnb/session.c +++ b/lib/rfcnb/session.c @@ -31,10 +31,10 @@ int RFCNB_saved_errno = 0; #include "rfcnb/std-includes.h" #include -#include "rfcnb/rfcnb.h" -#include "rfcnb/rfcnb-priv.h" #include "rfcnb/rfcnb-io.h" +#include "rfcnb/rfcnb-priv.h" #include "rfcnb/rfcnb-util.h" +#include "rfcnb/rfcnb.h" #if HAVE_STRING_H #include