Skip to content

Commit 07cfc5a

Browse files
author
batrick
committed
Corrected many #includes for header files (where they are included).
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).
1 parent c2fc8af commit 07cfc5a

18 files changed

+66
-71
lines changed

nse_binlib.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141

4242
#include <ctype.h>
4343
#include <string.h>
44+
#include <nbase.h>
45+
4446
extern "C" {
45-
#include "lua.h"
46-
#include "lualib.h"
47-
#include "lauxlib.h"
47+
#include "lua.h"
48+
#include "lauxlib.h"
4849
}
49-
#include <nbase.h>
5050
#include "nse_binlib.h"
5151

5252
static void badcode(lua_State *L, int c)

nse_bit.cc

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* the most recent copy can be found at http://rrt.sc3d.org/Software/Lua/
99
**/
1010

11+
extern "C" {
12+
#include "lauxlib.h"
13+
#include "lua.h"
14+
}
15+
1116
#include "nse_bit.h"
1217

1318
typedef long long Integer;

nse_bit.h

-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33

44
#define BITLIBNAME "bit"
55

6-
extern "C" {
7-
#include "lauxlib.h"
8-
#include "lua.h"
9-
}
10-
116
LUALIB_API int luaopen_bit(lua_State *L);
127

138
#endif
14-

nse_debug.cc

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
extern "C" {
3+
#include "lua.h"
4+
#include "lauxlib.h"
5+
}
6+
17
#include "nse_debug.h"
28
#include "output.h"
39

nse_debug.h

-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#ifndef NSE_DEBUG
22
#define NSE_DEBUG
33

4-
extern "C" {
5-
#include "lua.h"
6-
#include "lualib.h"
7-
#include "lauxlib.h"
8-
}
9-
104
void value_dump(lua_State *L, int i, int depth_limit);
115
void stack_dump(lua_State *L);
126
void lua_state_dump(lua_State *L);

nse_fs.cc

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2+
extern "C" {
3+
#include "lua.h"
4+
#include "lauxlib.h"
5+
}
6+
7+
#include <vector>
8+
#include <string>
9+
#include <string.h>
10+
111
#ifndef WIN32
212
#include "dirent.h"
313
#endif

nse_fs.h

-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
#ifndef NSE_FS
22
#define NSE_FS
33

4-
extern "C" {
5-
#include "lua.h"
6-
#include "lualib.h"
7-
#include "lauxlib.h"
8-
}
9-
10-
#include <vector>
11-
#include <string>
12-
#include <string.h>
13-
144
int nse_check_extension (const char* ext, const char* path);
155

166
int nse_fetchfile(char *path, size_t path_len, const char *file);

nse_init.cc

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2+
extern "C" {
3+
#include "lua.h"
4+
#include "lauxlib.h"
5+
#include "lualib.h" /* for libraries */
6+
}
7+
8+
#include <vector>
9+
#include <string>
10+
#include <string.h>
11+
112
#include "nse_init.h"
213
#include "nse_nmaplib.h"
314
#include "nse_macros.h"

nse_init.h

-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
#ifndef NSE_INIT
22
#define NSE_INIT
33

4-
extern "C" {
5-
#include "lua.h"
6-
#include "lualib.h"
7-
#include "lauxlib.h"
8-
}
9-
10-
#include <vector>
11-
#include <string>
12-
#include <string.h>
13-
144
// initialize the lua state
155
// opens the standard libraries and the nmap lua library
166
int init_lua(lua_State* L);

nse_main.cc

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
#include "nse_main.h"
23

34
#include "nse_init.h"

nse_main.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#ifndef NMAP_LUA_H
22
#define NMAP_LUA_H
33

4-
extern "C" {
5-
#include "lua.h"
6-
#include "lualib.h"
7-
#include "lauxlib.h"
8-
}
9-
104
#include <vector>
115
#include <list>
126
#include <string>
137
#include <string.h>
148
#include <iostream>
159

10+
extern "C" {
11+
#include "lua.h"
12+
#include "lauxlib.h"
13+
}
14+
1615
class ScriptResult
1716
{
1817
private:

nse_nmaplib.cc

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
extern "C" {
3+
#include "lua.h"
4+
#include "lauxlib.h"
5+
}
6+
17
#include <math.h>
28

39
#include "nmap.h"

nse_nmaplib.h

-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#ifndef NSE_NMAPLIB
22
#define NSE_NMAPLIB
33

4-
extern "C" {
5-
#include "lua.h"
6-
#include "lualib.h"
7-
#include "lauxlib.h"
8-
}
9-
104
class Target;
115
class Port;
126

nse_nsock.cc

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
#include "nse_nsock.h"
2-
#include "nse_macros.h"
3-
4-
#include "nse_debug.h"
51

6-
#include "nsock.h"
7-
#include "nmap_error.h"
8-
/* #include "osscan.h" */
9-
#include "NmapOps.h"
2+
extern "C" {
3+
#include "lua.h"
4+
#include "lauxlib.h"
5+
}
106

117
#include <stdio.h>
128
#include <stdlib.h>
139
#include <errno.h>
1410
#include <sstream>
1511
#include <iomanip>
1612

13+
#include "nse_nsock.h"
14+
#include "nse_macros.h"
15+
#include "nse_debug.h"
16+
17+
#include "nsock.h"
18+
#include "nmap_error.h"
19+
#include "NmapOps.h"
1720
#include "utils.h"
1821
#include "tcpip.h"
1922

nse_nsock.h

-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#ifndef NMAP_LUA_NSOCK_H
22
#define NMAP_LUA_NSOCK_H
33

4-
extern "C" {
5-
#include "lua.h"
6-
#include "lualib.h"
7-
#include "lauxlib.h"
8-
}
9-
104
int luaopen_nsock(lua_State *);
115
int l_nsock_new(lua_State *);
126
int l_nsock_loop(int tout);

nse_openssl.cc

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818
#include <openssl/evp.h>
1919
#include <openssl/err.h>
2020

21+
extern "C" {
22+
#include "lua.h"
23+
#include "lauxlib.h"
24+
}
25+
2126
#include "nse_openssl.h"
22-
#include "lua.h"
23-
#include "lauxlib.h"
2427

2528
typedef struct bignum_data {
2629
BIGNUM * bn;

nse_openssl.h

-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33

44
#define OPENSSLLIBNAME "openssl"
55

6-
extern "C" {
7-
#include "lua.h"
8-
#include "lauxlib.h"
9-
}
10-
116
LUALIB_API int luaopen_openssl(lua_State *L);
127

138
#endif

nse_pcrelib.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include <string.h>
99

1010
extern "C" {
11-
#include "lua.h"
12-
#include "lauxlib.h"
11+
#include "lua.h"
12+
#include "lauxlib.h"
1313
}
1414

1515
#include <locale.h>

0 commit comments

Comments
 (0)