Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: [RFC] Headers and #include cleanup
From: Daniel Miller <bonsaiviking () gmail com>
Date: Tue, 26 Nov 2013 14:47:53 -0600

On 11/14/2013 11:16 AM, Daniel Miller wrote:

I took it upon myself to do some header file cleanup. The attached
patch has my work so far. A quick summary of the changes:

* #ifndef guards added to a few header files where they were not present.
* Unneeded #includes removed.
* Removed #includes of nbase.h and global_structures.h from files that
already included nmap.h
* Moved some unconditional #includes out of nmap.h and into the
appropriate *.cc files: math.h, ctype.h, errno.h, stdio.h, sys/stat.h,
fcntl.h, sys/types.h, and stdarg.h
* Remove some conditional includes from files (tcpip.h, targets.h,
services.h, utils.h) that already got them by including nmap.h

I didn't notice any particular speedup in compilation time, but I'm
working on a pretty speedy computer. This patch serves more as a
cleanup (118 fewer net lines) and a basis for some future refactoring
that I have planned. Some ideas going forward:

* Disentangle global_structures.h from nmap.h. Currently, nmap.h must
include global_structures.h, and global_structures.h cannot be
included without including nmap.h. Either there is no benefit to 2
separate files, or they must be separated more completely.
* Refactor FTP bounce scan code out of nmap.{h,cc}, scan_engine.cc,
and global_structures.h and into nmap_ftp.{h,cc}. I already have a
patch for this.
* Examine Makefile.in to be sure all targets can be built (currently
have problems with "make nmap") and perhaps add a "uninstall" target.

As always, your thoughts are appreciated! I will be offline for about
a week, so I will wait to commit this until after then at least.


I committed this change in r32528. It compiles on i686-pc-gnu-linux under gcc and clang. Please report any bugs!

Sent through the dev mailing list
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]