[vlc-devel] [PATCH 2/3] Consolidate lua includes in vlc.h so lua 5.2 compatibility declarations can be made in one place.

Kelly Anderson kelly at silka.with-linux.com
Thu Jan 5 14:23:36 CET 2012


---
 modules/lua/intf.c               |    4 ----
 modules/lua/libs/acl.c           |    3 ---
 modules/lua/libs/configuration.c |    3 ---
 modules/lua/libs/dialog.c        |    3 ---
 modules/lua/libs/equalizer.c     |    3 ---
 modules/lua/libs/gettext.c       |    4 ----
 modules/lua/libs/httpd.c         |    4 ----
 modules/lua/libs/input.c         |    4 +---
 modules/lua/libs/input.h         |    2 ++
 modules/lua/libs/messages.c      |    4 ----
 modules/lua/libs/misc.c          |    4 ----
 modules/lua/libs/net.c           |    3 ---
 modules/lua/libs/objects.c       |    3 ---
 modules/lua/libs/osd.c           |    3 ---
 modules/lua/libs/playlist.c      |    3 ---
 modules/lua/libs/sd.c            |    4 ----
 modules/lua/libs/stream.c        |    3 ---
 modules/lua/libs/strings.c       |    3 ---
 modules/lua/libs/variables.c     |    4 ----
 modules/lua/libs/video.c         |    3 ---
 modules/lua/libs/vlm.c           |    3 ---
 modules/lua/libs/volume.c        |    4 ----
 modules/lua/libs/xml.c           |    3 ---
 modules/lua/vlc.c                |    4 ----
 modules/lua/vlc.h                |    6 ++++++
 25 files changed, 9 insertions(+), 78 deletions(-)

diff --git a/modules/lua/intf.c b/modules/lua/intf.c
index 3b01727..61fe362 100644
--- a/modules/lua/intf.c
+++ b/modules/lua/intf.c
@@ -37,10 +37,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "vlc.h"
 #include "libs.h"
 
diff --git a/modules/lua/libs/acl.c b/modules/lua/libs/acl.c
index 4deb66e..693137d 100644
--- a/modules/lua/libs/acl.c
+++ b/modules/lua/libs/acl.c
@@ -35,9 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_acl.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/configuration.c b/modules/lua/libs/configuration.c
index 7a4785f..7b5f732 100644
--- a/modules/lua/libs/configuration.c
+++ b/modules/lua/libs/configuration.c
@@ -34,9 +34,6 @@
 
 #include <vlc_common.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/dialog.c b/modules/lua/libs/dialog.c
index 3ca67b2..55468f3 100644
--- a/modules/lua/libs/dialog.c
+++ b/modules/lua/libs/dialog.c
@@ -35,9 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_extensions.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/equalizer.c b/modules/lua/libs/equalizer.c
index 75b2334..e698c6f 100644
--- a/modules/lua/libs/equalizer.c
+++ b/modules/lua/libs/equalizer.c
@@ -38,9 +38,6 @@
 #include <vlc_input.h>
 #include <vlc_charset.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "input.h"
 #include "../libs.h"
 #include "../vlc.h"
diff --git a/modules/lua/libs/gettext.c b/modules/lua/libs/gettext.c
index b461e73..2781d35 100644
--- a/modules/lua/libs/gettext.c
+++ b/modules/lua/libs/gettext.c
@@ -32,10 +32,6 @@
 # include "config.h"
 #endif
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/httpd.c b/modules/lua/libs/httpd.c
index b4520d9..85a38cc 100644
--- a/modules/lua/libs/httpd.c
+++ b/modules/lua/libs/httpd.c
@@ -35,10 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_httpd.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 60211fd..7b413e2 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -37,13 +37,11 @@
 
 #include <vlc_playlist.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
 #include <assert.h>
 
+#include "../vlc.h"
 #include "input.h"
 #include "playlist.h"
-#include "../vlc.h"
 #include "../libs.h"
 #include "../extension.h"
 
diff --git a/modules/lua/libs/input.h b/modules/lua/libs/input.h
index dbe76df..903134a 100644
--- a/modules/lua/libs/input.h
+++ b/modules/lua/libs/input.h
@@ -24,6 +24,8 @@
 #ifndef VLC_LUA_INPUT_H
 #define VLC_LUA_INPUT_H
 
+#include "../vlc.h"
+
 input_thread_t * vlclua_get_input_internal( lua_State * );
 
 #endif
diff --git a/modules/lua/libs/messages.c b/modules/lua/libs/messages.c
index 9c40e53..589d162 100644
--- a/modules/lua/libs/messages.c
+++ b/modules/lua/libs/messages.c
@@ -38,10 +38,6 @@
 #include <vlc_meta.h>
 #include <vlc_aout.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/misc.c b/modules/lua/libs/misc.c
index f98d28a..5b793bd 100644
--- a/modules/lua/libs/misc.c
+++ b/modules/lua/libs/misc.c
@@ -41,10 +41,6 @@
 #include <vlc_interface.h>
 #include <vlc_keys.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/net.c b/modules/lua/libs/net.c
index 1c7cd12..0e832cc 100644
--- a/modules/lua/libs/net.c
+++ b/modules/lua/libs/net.c
@@ -41,9 +41,6 @@
 #include <vlc_url.h>
 #include <vlc_fs.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #ifdef HAVE_POLL
 #include <poll.h>       /* poll structures and defines */
 #endif
diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index c3543d6..bcdb43e 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -35,9 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_vout.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 #include "objects.h"
diff --git a/modules/lua/libs/osd.c b/modules/lua/libs/osd.c
index fb36ed5..e06646b 100644
--- a/modules/lua/libs/osd.c
+++ b/modules/lua/libs/osd.c
@@ -35,9 +35,6 @@
 #include <vlc_vout.h>
 #include <vlc_osd.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 #include "input.h"
diff --git a/modules/lua/libs/playlist.c b/modules/lua/libs/playlist.c
index ae610f3..2336a37 100644
--- a/modules/lua/libs/playlist.c
+++ b/modules/lua/libs/playlist.c
@@ -37,9 +37,6 @@
 #include <vlc_interface.h>
 #include <vlc_playlist.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 #include "playlist.h"
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index 7ca9476..d88cab2 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -38,10 +38,6 @@
 #include <vlc_playlist.h>
 #include <vlc_charset.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "../vlc.h"
 #include "../libs.h"
 #include "playlist.h"
diff --git a/modules/lua/libs/stream.c b/modules/lua/libs/stream.c
index ef7187c..6a366f1 100644
--- a/modules/lua/libs/stream.c
+++ b/modules/lua/libs/stream.c
@@ -38,9 +38,6 @@
 #include <vlc_meta.h>
 #include <vlc_aout.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/strings.c b/modules/lua/libs/strings.c
index ab8e435..88c5f0e 100644
--- a/modules/lua/libs/strings.c
+++ b/modules/lua/libs/strings.c
@@ -39,9 +39,6 @@
 #include <vlc_aout.h>
 #include <vlc_charset.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/variables.c b/modules/lua/libs/variables.c
index f3becae..aad5ae1 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -34,10 +34,6 @@
 
 #include <vlc_common.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "../vlc.h"
 #include "../libs.h"
 #include "variables.h"
diff --git a/modules/lua/libs/video.c b/modules/lua/libs/video.c
index eb914b5..258e0d2 100644
--- a/modules/lua/libs/video.c
+++ b/modules/lua/libs/video.c
@@ -34,9 +34,6 @@
 
 #include <vlc_vout.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 #include "input.h"
diff --git a/modules/lua/libs/vlm.c b/modules/lua/libs/vlm.c
index d48755c..7b2b708 100644
--- a/modules/lua/libs/vlm.c
+++ b/modules/lua/libs/vlm.c
@@ -35,9 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_vlm.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/libs/volume.c b/modules/lua/libs/volume.c
index 3aab542..bae1534 100644
--- a/modules/lua/libs/volume.c
+++ b/modules/lua/libs/volume.c
@@ -38,10 +38,6 @@
 #include <vlc_meta.h>
 #include <vlc_aout_intf.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "../vlc.h"
 #include "../libs.h"
 #include "playlist.h"
diff --git a/modules/lua/libs/xml.c b/modules/lua/libs/xml.c
index f8b0afe..80f53fb 100644
--- a/modules/lua/libs/xml.c
+++ b/modules/lua/libs/xml.c
@@ -35,9 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_xml.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-
 #include "../vlc.h"
 #include "../libs.h"
 
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 5433eb8..a0132cf 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -45,10 +45,6 @@
 #include <vlc_stream.h>
 #include <sys/stat.h>
 
-#include <lua.h>        /* Low level lua C API */
-#include <lauxlib.h>    /* Higher level C API */
-#include <lualib.h>     /* Lua libs */
-
 #include "vlc.h"
 
 /*****************************************************************************
diff --git a/modules/lua/vlc.h b/modules/lua/vlc.h
index 5d87914..2b8fbff 100644
--- a/modules/lua/vlc.h
+++ b/modules/lua/vlc.h
@@ -36,9 +36,15 @@
 #include <vlc_strings.h>
 #include <vlc_stream.h>
 
+#define LUA_COMPAT_MODULE
 #include <lua.h>        /* Low level lua C API */
 #include <lauxlib.h>    /* Higher level C API */
 #include <lualib.h>     /* Lua libs */
+#if LUA_VERSION_NUM >= 502
+#define lua_equal(L,idx1,idx2)		lua_compare(L,(idx1),(idx2),LUA_OPEQ)
+#define lua_objlen(L,idx)			lua_rawlen(L,idx)
+#define lua_strlen(L,idx)			lua_rawlen(L,idx)
+#endif
 
 /*****************************************************************************
  * Module entry points
-- 
1.7.8.2




More information about the vlc-devel mailing list