diff options
author | Mike Pall <mike> | 2011-05-08 22:33:04 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-05-08 22:33:04 +0200 |
commit | 77ba7726e2f8b6ffe86be6c89b5beda5cab86d2d (patch) | |
tree | 476f063d2f19470222e61aa26865ce4d68200a7d /src/lj_dispatch.h | |
parent | 87553d9e77f440da012ed79eb373feaea8b03315 (diff) | |
download | luajit-77ba7726e2f8b6ffe86be6c89b5beda5cab86d2d.tar.gz luajit-77ba7726e2f8b6ffe86be6c89b5beda5cab86d2d.tar.bz2 luajit-77ba7726e2f8b6ffe86be6c89b5beda5cab86d2d.zip |
FFI: Save errno/GetLastError() around allocations, hooks etc.
Diffstat (limited to 'src/lj_dispatch.h')
-rw-r--r-- | src/lj_dispatch.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h index 3ba983a8..dd4f68fe 100644 --- a/src/lj_dispatch.h +++ b/src/lj_dispatch.h | |||
@@ -69,4 +69,21 @@ LJ_FUNCA void LJ_FASTCALL lj_dispatch_ins(lua_State *L, const BCIns *pc); | |||
69 | LJ_FUNCA ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns*pc); | 69 | LJ_FUNCA ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns*pc); |
70 | LJ_FUNCA void LJ_FASTCALL lj_dispatch_return(lua_State *L, const BCIns *pc); | 70 | LJ_FUNCA void LJ_FASTCALL lj_dispatch_return(lua_State *L, const BCIns *pc); |
71 | 71 | ||
72 | #if LJ_HASFFI && !defined(_BUILDVM_H) | ||
73 | /* Save/restore errno and GetLastError() around hooks, exits and recording. */ | ||
74 | #include <errno.h> | ||
75 | #if LJ_TARGET_WINDOWS | ||
76 | #define WIN32_LEAN_AND_MEAN | ||
77 | #include <windows.h> | ||
78 | #define ERRNO_SAVE int olderr = errno; DWORD oldwerr = GetLastError(); | ||
79 | #define ERRNO_RESTORE errno = olderr; SetLastError(oldwerr); | ||
80 | #else | ||
81 | #define ERRNO_SAVE int olderr = errno; | ||
82 | #define ERRNO_RESTORE errno = olderr; | ||
83 | #endif | ||
84 | #else | ||
85 | #define ERRNO_SAVE | ||
86 | #define ERRNO_RESTORE | ||
87 | #endif | ||
88 | |||
72 | #endif | 89 | #endif |