Home page logo
/

nmap-dev logo Nmap Development mailing list archives

[RFC] Headers and #include cleanup
From: Daniel Miller <bonsaiviking () gmail com>
Date: Thu, 14 Nov 2013 11:16:00 -0600

List,

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.

Dan

Attachment: headers.patch
Description:

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

  By Date           By Thread  

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