Skip to content

Commit

Permalink
Use LSYNCD_*LIBNAME to refer to lsyncd/.inotify tables
Browse files Browse the repository at this point in the history
This should prevent typos and resulting issues
  • Loading branch information
devurandom committed Oct 2, 2012
1 parent 68982e6 commit dea7e87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion inotify.c
Expand Up @@ -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);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions lsyncd.c
Expand Up @@ -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");
Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions lsyncd.h
Expand Up @@ -28,6 +28,9 @@
#define LUA_USE_APICHECK 1
#include <lua.h>

#define LSYNCD_LIBNAME "lsyncd"
#define LSYNCD_INOTIFYLIBNAME "inotify"

/**
* Lsyncd runtime configuration
*/
Expand Down

0 comments on commit dea7e87

Please sign in to comment.