From d4e49f10752572d73dbf0e8aab1ebcd14ca34b8d Mon Sep 17 00:00:00 2001 From: david Date: Thu, 4 Nov 2010 22:43:00 +0000 Subject: [PATCH] Rearrange some headers to make sure that out nbase errno defines are seen early, avoiding warning about symbol redefinitions. This is mostly moving "nmap.h" to the top of the list. --- MACLookup.cc | 3 ++- nmap_dns.cc | 12 ++++++------ nmap_tty.cc | 2 ++ nse_debug.cc | 1 + nse_fs.cc | 15 ++++++++------- output.cc | 1 + payload.cc | 2 ++ portlist.cc | 2 +- portreasons.cc | 3 ++- services.cc | 7 ++++--- xml.cc | 7 ++++--- 11 files changed, 33 insertions(+), 22 deletions(-) diff --git a/MACLookup.cc b/MACLookup.cc index 32853a8e4b..9ac6fb90a3 100644 --- a/MACLookup.cc +++ b/MACLookup.cc @@ -91,12 +91,13 @@ /* $Id$ */ +#include "nmap.h" + #include /* Character pool memory allocation */ #include "MACLookup.h" #include "NmapOps.h" -#include "nmap.h" #include "nmap_error.h" #include "charpool.h" diff --git a/nmap_dns.cc b/nmap_dns.cc index a64ac405d8..68e735e6e0 100644 --- a/nmap_dns.cc +++ b/nmap_dns.cc @@ -148,12 +148,6 @@ #include "nmap_winconfig.h" #endif -#include -#include -#include -#include -#include - #include "nmap.h" #include "NmapOps.h" #include "nmap_dns.h" @@ -163,6 +157,12 @@ #include "timing.h" #include "Target.h" +#include +#include +#include +#include +#include + extern NmapOps o; diff --git a/nmap_tty.cc b/nmap_tty.cc index 6b42f70b5b..21c851335a 100644 --- a/nmap_tty.cc +++ b/nmap_tty.cc @@ -91,6 +91,8 @@ #include "nmap_config.h" #endif +#include "nmap.h" + #include #if HAVE_SYS_STAT_H #include diff --git a/nse_debug.cc b/nse_debug.cc index 8b43aed558..3c03c3642a 100644 --- a/nse_debug.cc +++ b/nse_debug.cc @@ -4,6 +4,7 @@ extern "C" { #include "lauxlib.h" } +#include "nmap.h" #include "nse_debug.h" #include "output.h" diff --git a/nse_fs.cc b/nse_fs.cc index bfce8e74e4..38b882b0e1 100644 --- a/nse_fs.cc +++ b/nse_fs.cc @@ -4,19 +4,20 @@ extern "C" { #include "lauxlib.h" } -#include +#include "nmap.h" +#include "nse_fs.h" +#include "nmap_error.h" +#include "NmapOps.h" + +#include #include +#include + #ifndef WIN32 #include "dirent.h" #endif -#include "errno.h" -#include "nse_fs.h" -#include "nmap.h" -#include "nmap_error.h" -#include "NmapOps.h" - #define DIR_METATABLE "dir" #ifndef MAXPATHLEN diff --git a/output.cc b/output.cc index 50ce599d1d..8576d1f243 100644 --- a/output.cc +++ b/output.cc @@ -94,6 +94,7 @@ /* $Id$ */ +#include "nmap.h" #include "output.h" #include "osscan.h" #include "NmapOps.h" diff --git a/payload.cc b/payload.cc index a783767071..4a6992c5da 100644 --- a/payload.cc +++ b/payload.cc @@ -89,6 +89,8 @@ /* $Id$ */ +#include "nmap.h" + #include #include #include diff --git a/portlist.cc b/portlist.cc index bcd46ddca4..b03c6e9a10 100644 --- a/portlist.cc +++ b/portlist.cc @@ -90,9 +90,9 @@ /* $Id$ */ +#include "nmap.h" #include "portlist.h" #include "nmap_error.h" -#include "nmap.h" #include "NmapOps.h" #include "services.h" #include "protocols.h" diff --git a/portreasons.cc b/portreasons.cc index 17a9b7ef15..7438e7b64a 100644 --- a/portreasons.cc +++ b/portreasons.cc @@ -90,7 +90,6 @@ * Written by Eddie Bell 2007 */ -#include #include "nmap.h" #include "portlist.h" #include "NmapOps.h" @@ -101,6 +100,8 @@ #include "winfix.h" #endif +#include + extern NmapOps o; class PortList; diff --git a/services.cc b/services.cc index d91ab316b6..e53dfdcc15 100644 --- a/services.cc +++ b/services.cc @@ -90,15 +90,16 @@ /* $Id$ */ -#include -#include - +#include "nmap.h" #include "services.h" #include "NmapOps.h" #include "charpool.h" #include "nmap_error.h" #include "utils.h" +#include +#include + /* This structure is the key for looking up services in the port/proto -> service map. */ struct port_spec { diff --git a/xml.cc b/xml.cc index efb13b38de..f0cb98e7f2 100644 --- a/xml.cc +++ b/xml.cc @@ -145,14 +145,15 @@ All writing is done with log_write(LOG_XML), so if LOG_XML hasn't been opened, calling these functions has no effect. */ +#include "nmap.h" +#include "output.h" +#include "xml.h" + #include #include #include #include -#include "output.h" -#include "xml.h" - struct xml_writer { /* Sanity checking: Don't open a new tag while still defining attributes for another, like "