diff options
Diffstat (limited to 'ltests.h')
-rw-r--r-- | ltests.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.h,v 2.36 2014/07/23 16:47:47 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 2.37 2014/07/23 17:16:50 roberto Exp roberto $ |
3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -64,14 +64,15 @@ int lua_checkmemory (lua_State *L); | |||
64 | /* test for lock/unlock */ | 64 | /* test for lock/unlock */ |
65 | 65 | ||
66 | struct L_EXTRA { int lock; int *plock; }; | 66 | struct L_EXTRA { int lock; int *plock; }; |
67 | /* extra space before a Lua state (+1 to make it unaligned) */ | 67 | #undef LUA_EXTRASPACE |
68 | #define LUAI_EXTRASPACE (sizeof(struct L_EXTRA) + 1) | 68 | #define LUA_EXTRASPACE sizeof(struct L_EXTRA) |
69 | #define getlock(l) (cast(struct L_EXTRA *, l) - 1) | 69 | #define getlock(l) cast(struct L_EXTRA*, lua_getextraspace(l)) |
70 | #define luai_userstateopen(l) \ | 70 | #define luai_userstateopen(l) \ |
71 | (getlock(l)->lock = 0, getlock(l)->plock = &(getlock(l)->lock)) | 71 | (getlock(l)->lock = 0, getlock(l)->plock = &(getlock(l)->lock)) |
72 | #define luai_userstateclose(l) \ | 72 | #define luai_userstateclose(l) \ |
73 | lua_assert(getlock(l)->lock == 1 && getlock(l)->plock == &(getlock(l)->lock)) | 73 | lua_assert(getlock(l)->lock == 1 && getlock(l)->plock == &(getlock(l)->lock)) |
74 | #define luai_userstatethread(l,l1) (getlock(l1)->plock = getlock(l)->plock) | 74 | #define luai_userstatethread(l,l1) \ |
75 | lua_assert(getlock(l1)->plock == getlock(l)->plock) | ||
75 | #define luai_userstatefree(l,l1) \ | 76 | #define luai_userstatefree(l,l1) \ |
76 | lua_assert(getlock(l)->plock == getlock(l1)->plock) | 77 | lua_assert(getlock(l)->plock == getlock(l1)->plock) |
77 | #define lua_lock(l) lua_assert((*getlock(l)->plock)++ == 0) | 78 | #define lua_lock(l) lua_assert((*getlock(l)->plock)++ == 0) |