Use LSYNCD_*LIBNAME to refer to lsyncd/.inotify tables

This should prevent typos and resulting issues
This commit is contained in:
Dennis Schridde 2012-10-02 02:56:29 +02:00
parent 68982e6e5b
commit dea7e87b40
3 changed files with 8 additions and 5 deletions

View File

@ -351,7 +351,7 @@ inotify_ready(lua_State *L, struct observance *obs)
extern void extern void
register_inotify(lua_State *L) register_inotify(lua_State *L)
{ {
luaL_register(L, "inotify", linotfylib); luaL_register(L, LSYNCD_INOTIFYLIBNAME, linotfylib);
} }
/** /**

View File

@ -1368,8 +1368,8 @@ l_jiffies_le(lua_State *L)
void void
register_lsyncd(lua_State *L) register_lsyncd(lua_State *L)
{ {
luaL_register(L, "lsyncd", lsyncdlib); luaL_register(L, LSYNCD_LIBNAME, lsyncdlib);
lua_setglobal(L, "lsyncd"); lua_setglobal(L, LSYNCD_LIBNAME);
// creates the metatable for jiffies userdata // creates the metatable for jiffies userdata
luaL_newmetatable(L, "Lsyncd.jiffies"); luaL_newmetatable(L, "Lsyncd.jiffies");
@ -1393,9 +1393,9 @@ register_lsyncd(lua_State *L)
lua_pop(L, 1); // pop(mt) lua_pop(L, 1); // pop(mt)
#ifdef LSYNCD_WITH_INOTIFY #ifdef LSYNCD_WITH_INOTIFY
lua_getglobal(L, "lsyncd"); lua_getglobal(L, LSYNCD_LIBNAME);
register_inotify(L); register_inotify(L);
lua_setfield(L, -2, "inotify"); lua_setfield(L, -2, LSYNCD_INOTIFYLIBNAME);
lua_pop(L, 1); lua_pop(L, 1);
#endif #endif

View File

@ -28,6 +28,9 @@
#define LUA_USE_APICHECK 1 #define LUA_USE_APICHECK 1
#include <lua.h> #include <lua.h>
#define LSYNCD_LIBNAME "lsyncd"
#define LSYNCD_INOTIFYLIBNAME "inotify"
/** /**
* Lsyncd runtime configuration * Lsyncd runtime configuration
*/ */