From dea7e87b4044142a6210c157a6d4ea00e60d29eb Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Tue, 2 Oct 2012 02:56:29 +0200 Subject: [PATCH] Use LSYNCD_*LIBNAME to refer to lsyncd/.inotify tables This should prevent typos and resulting issues --- inotify.c | 2 +- lsyncd.c | 8 ++++---- lsyncd.h | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/inotify.c b/inotify.c index 0d3916c..fcbcef0 100644 --- a/inotify.c +++ b/inotify.c @@ -351,7 +351,7 @@ inotify_ready(lua_State *L, struct observance *obs) extern void register_inotify(lua_State *L) { - luaL_register(L, "inotify", linotfylib); + luaL_register(L, LSYNCD_INOTIFYLIBNAME, linotfylib); } /** diff --git a/lsyncd.c b/lsyncd.c index b2c9d47..44a4a5d 100644 --- a/lsyncd.c +++ b/lsyncd.c @@ -1368,8 +1368,8 @@ l_jiffies_le(lua_State *L) void register_lsyncd(lua_State *L) { - luaL_register(L, "lsyncd", lsyncdlib); - lua_setglobal(L, "lsyncd"); + luaL_register(L, LSYNCD_LIBNAME, lsyncdlib); + lua_setglobal(L, LSYNCD_LIBNAME); // creates the metatable for jiffies userdata luaL_newmetatable(L, "Lsyncd.jiffies"); @@ -1393,9 +1393,9 @@ register_lsyncd(lua_State *L) lua_pop(L, 1); // pop(mt) #ifdef LSYNCD_WITH_INOTIFY - lua_getglobal(L, "lsyncd"); + lua_getglobal(L, LSYNCD_LIBNAME); register_inotify(L); - lua_setfield(L, -2, "inotify"); + lua_setfield(L, -2, LSYNCD_INOTIFYLIBNAME); lua_pop(L, 1); #endif diff --git a/lsyncd.h b/lsyncd.h index 88ef323..fa598a7 100644 --- a/lsyncd.h +++ b/lsyncd.h @@ -28,6 +28,9 @@ #define LUA_USE_APICHECK 1 #include +#define LSYNCD_LIBNAME "lsyncd" +#define LSYNCD_INOTIFYLIBNAME "inotify" + /** * Lsyncd runtime configuration */