aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-01-13 22:06:12 +0000
committerGuy Harris <guy@alum.mit.edu>2014-01-13 22:06:12 +0000
commit59722b868dbab7395fcea01beefef8a496af0a74 (patch)
tree7e193b44d4f78b9d5cf306c3cbab468e89878cf8 /epan/wslua
parent020230e865033fb9ab0e2f7db0b5eee6d8fa88a2 (diff)
In a source file that defines external functions, the header file that
declares the functions must be included, in order to make sure the declarations match the function signature. Make it so - which means creating the header file in the first place. That means luaopen_bit() doesn't need to, and shouldn't be, declared in wslua.h. Have make-reg.pl generate a #include of lua_bitop.h. Also fix the "this is autogenerated" warning. svn path=/trunk/; revision=54725
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/Makefile.am1
-rw-r--r--epan/wslua/lua_bitop.c2
-rw-r--r--epan/wslua/lua_bitop.h34
-rwxr-xr-xepan/wslua/make-reg.pl8
-rw-r--r--epan/wslua/wslua.h2
5 files changed, 42 insertions, 5 deletions
diff --git a/epan/wslua/Makefile.am b/epan/wslua/Makefile.am
index a037e2f964..88f063c84d 100644
--- a/epan/wslua/Makefile.am
+++ b/epan/wslua/Makefile.am
@@ -79,6 +79,7 @@ MAINTAINERCLEANFILES = \
EXTRA_DIST = \
declare_wslua.h \
+ lua_bitop.h \
register_wslua.c \
taps \
make-reg.pl \
diff --git a/epan/wslua/lua_bitop.c b/epan/wslua/lua_bitop.c
index 5db24d5e02..b20b575325 100644
--- a/epan/wslua/lua_bitop.c
+++ b/epan/wslua/lua_bitop.c
@@ -32,6 +32,8 @@
#include <lua.h>
#include <lauxlib.h>
+#include "lua_bitop.h"
+
#ifdef _MSC_VER
/* MSVC is stuck in the last century and doesn't have C99's stdint.h. */
typedef __int32 int32_t;
diff --git a/epan/wslua/lua_bitop.h b/epan/wslua/lua_bitop.h
new file mode 100644
index 0000000000..24b08c3e21
--- /dev/null
+++ b/epan/wslua/lua_bitop.h
@@ -0,0 +1,34 @@
+/*
+** Lua BitOp -- a bit operations library for Lua 5.1/5.2.
+** http://bitop.luajit.org/
+**
+** Copyright (C) 2008-2012 Mike Pall. All rights reserved.
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
+*/
+
+#ifndef _LUA_BITOP_H
+#define _LUA_BITOP_H
+
+extern int luaopen_bit(lua_State *L);
+
+#endif /* _LUA_BITOP_H */
diff --git a/epan/wslua/make-reg.pl b/epan/wslua/make-reg.pl
index 4323805847..ba8b958a76 100755
--- a/epan/wslua/make-reg.pl
+++ b/epan/wslua/make-reg.pl
@@ -38,8 +38,8 @@ while (<>) {
open C, ">register_wslua.c";
open H, ">declare_wslua.h";
-print H "/* This file is automatically genrated by make-reg.pl do not edit */\n\n";
-print C "/* This file is automatically genrated by make-reg.pl do not edit */\n\n";
+print H "/* This file is automatically generated by make-reg.pl; do not edit! */\n\n";
+print C "/* This file is automatically generated by make-reg.pl; do not edit! */\n\n";
print H "#define WSLUA_DECLARE_CLASSES() \\\n";
for (@classes) {
@@ -58,7 +58,9 @@ print H "\n\n";
print C '#include "config.h"' . "\n";
-print C '#include "wslua.h"' . "\n\n";
+print C '#include "wslua.h"' . "\n\n";
+print C '#include "lua_bitop.h"' . "\n\n";
+
print C "static void wslua_reg_module(lua_State* L, const char *name, lua_CFunction func) { \n";
print C "\tlua_pushcfunction(L, func);\n";
print C "\tlua_pushstring(L, name);\n";
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 329a58a3fe..fd223f382f 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -473,8 +473,6 @@ extern int wslua_cleanup(void);
extern tap_extractor_t wslua_get_tap_extractor(const gchar* name);
extern int wslua_set_tap_enums(lua_State* L);
-extern int luaopen_bit(lua_State *L);
-
extern int wslua_is_field_available(lua_State* L, const char* field_abbr);
#endif