Skip to content

Commit

Permalink
Corrected many #includes for header files (where they are included).
Browse files Browse the repository at this point in the history
Moved the includes for Lua headers to the .cc files so they are
not needlessly, repeatedly included.

Similarly, moved some standard headers to the .cc files and reorganized
includes to be uniform for all nse_* source files.

Fixed whitespace (removed tabs).
  • Loading branch information
batrick committed Mar 10, 2009
1 parent c2fc8af commit 07cfc5a
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 71 deletions.
8 changes: 4 additions & 4 deletions nse_binlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@

#include <ctype.h>
#include <string.h>
#include <nbase.h>

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include "lua.h"
#include "lauxlib.h"
}
#include <nbase.h>
#include "nse_binlib.h"

static void badcode(lua_State *L, int c)
Expand Down
5 changes: 5 additions & 0 deletions nse_bit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* the most recent copy can be found at http://rrt.sc3d.org/Software/Lua/
**/

extern "C" {
#include "lauxlib.h"
#include "lua.h"
}

#include "nse_bit.h"

typedef long long Integer;
Expand Down
6 changes: 0 additions & 6 deletions nse_bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@

#define BITLIBNAME "bit"

extern "C" {
#include "lauxlib.h"
#include "lua.h"
}

LUALIB_API int luaopen_bit(lua_State *L);

#endif

6 changes: 6 additions & 0 deletions nse_debug.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

extern "C" {
#include "lua.h"
#include "lauxlib.h"
}

#include "nse_debug.h"
#include "output.h"

Expand Down
6 changes: 0 additions & 6 deletions nse_debug.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#ifndef NSE_DEBUG
#define NSE_DEBUG

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

void value_dump(lua_State *L, int i, int depth_limit);
void stack_dump(lua_State *L);
void lua_state_dump(lua_State *L);
Expand Down
10 changes: 10 additions & 0 deletions nse_fs.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

extern "C" {
#include "lua.h"
#include "lauxlib.h"
}

#include <vector>
#include <string>
#include <string.h>

#ifndef WIN32
#include "dirent.h"
#endif
Expand Down
10 changes: 0 additions & 10 deletions nse_fs.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
#ifndef NSE_FS
#define NSE_FS

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

#include <vector>
#include <string>
#include <string.h>

int nse_check_extension (const char* ext, const char* path);

int nse_fetchfile(char *path, size_t path_len, const char *file);
Expand Down
11 changes: 11 additions & 0 deletions nse_init.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@

extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h" /* for libraries */
}

#include <vector>
#include <string>
#include <string.h>

#include "nse_init.h"
#include "nse_nmaplib.h"
#include "nse_macros.h"
Expand Down
10 changes: 0 additions & 10 deletions nse_init.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
#ifndef NSE_INIT
#define NSE_INIT

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

#include <vector>
#include <string>
#include <string.h>

// initialize the lua state
// opens the standard libraries and the nmap lua library
int init_lua(lua_State* L);
Expand Down
1 change: 1 addition & 0 deletions nse_main.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#include "nse_main.h"

#include "nse_init.h"
Expand Down
11 changes: 5 additions & 6 deletions nse_main.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#ifndef NMAP_LUA_H
#define NMAP_LUA_H

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

#include <vector>
#include <list>
#include <string>
#include <string.h>
#include <iostream>

extern "C" {
#include "lua.h"
#include "lauxlib.h"
}

class ScriptResult
{
private:
Expand Down
6 changes: 6 additions & 0 deletions nse_nmaplib.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

extern "C" {
#include "lua.h"
#include "lauxlib.h"
}

#include <math.h>

#include "nmap.h"
Expand Down
6 changes: 0 additions & 6 deletions nse_nmaplib.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#ifndef NSE_NMAPLIB
#define NSE_NMAPLIB

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

class Target;
class Port;

Expand Down
19 changes: 11 additions & 8 deletions nse_nsock.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#include "nse_nsock.h"
#include "nse_macros.h"

#include "nse_debug.h"

#include "nsock.h"
#include "nmap_error.h"
/* #include "osscan.h" */
#include "NmapOps.h"
extern "C" {
#include "lua.h"
#include "lauxlib.h"
}

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sstream>
#include <iomanip>

#include "nse_nsock.h"
#include "nse_macros.h"
#include "nse_debug.h"

#include "nsock.h"
#include "nmap_error.h"
#include "NmapOps.h"
#include "utils.h"
#include "tcpip.h"

Expand Down
6 changes: 0 additions & 6 deletions nse_nsock.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#ifndef NMAP_LUA_NSOCK_H
#define NMAP_LUA_NSOCK_H

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

int luaopen_nsock(lua_State *);
int l_nsock_new(lua_State *);
int l_nsock_loop(int tout);
Expand Down
7 changes: 5 additions & 2 deletions nse_openssl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
#include <openssl/evp.h>
#include <openssl/err.h>

extern "C" {
#include "lua.h"
#include "lauxlib.h"
}

#include "nse_openssl.h"
#include "lua.h"
#include "lauxlib.h"

typedef struct bignum_data {
BIGNUM * bn;
Expand Down
5 changes: 0 additions & 5 deletions nse_openssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

#define OPENSSLLIBNAME "openssl"

extern "C" {
#include "lua.h"
#include "lauxlib.h"
}

LUALIB_API int luaopen_openssl(lua_State *L);

#endif
4 changes: 2 additions & 2 deletions nse_pcrelib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <string.h>

extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lua.h"
#include "lauxlib.h"
}

#include <locale.h>
Expand Down

0 comments on commit 07cfc5a

Please sign in to comment.