mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-11 09:52:56 -04:00
MEDIUM: lua: move longjmp annotation macros to hlua.h
__LJMP, WILL_LJMP() and MAY_LJMP() were defined locally in hlua.c, making them unavailable to other modules that implement Lua bindings. Move them to include/haproxy/hlua.h so they can be used outside of hlua.c.
This commit is contained in:
parent
d0fde90e16
commit
5c0733db9a
2 changed files with 11 additions and 10 deletions
|
|
@ -26,6 +26,17 @@
|
|||
|
||||
#ifdef USE_LUA
|
||||
|
||||
/* Lua uses longjmp to perform yield or throwing errors. This
|
||||
* macro is used only for identifying the function that can
|
||||
* not return because a longjmp is executed.
|
||||
* __LJMP marks a prototype of hlua file that can use longjmp.
|
||||
* WILL_LJMP() marks an lua function that will use longjmp.
|
||||
* MAY_LJMP() marks an lua function that may use longjmp.
|
||||
*/
|
||||
#define __LJMP
|
||||
#define WILL_LJMP(func) do { func; my_unreachable(); } while(0)
|
||||
#define MAY_LJMP(func) func
|
||||
|
||||
/* The following macros are used to set flags. */
|
||||
#define HLUA_SET_RUN(__hlua) do {(__hlua)->flags |= HLUA_RUN;} while(0)
|
||||
#define HLUA_CLR_RUN(__hlua) do {(__hlua)->flags &= ~HLUA_RUN;} while(0)
|
||||
|
|
|
|||
10
src/hlua.c
10
src/hlua.c
|
|
@ -105,16 +105,6 @@ static uint8_t hlua_body = 1;
|
|||
*/
|
||||
static uint8_t hlua_bool_sample_conversion = HLUA_BOOL_SAMPLE_CONVERSION_UNK;
|
||||
|
||||
/* Lua uses longjmp to perform yield or throwing errors. This
|
||||
* macro is used only for identifying the function that can
|
||||
* not return because a longjmp is executed.
|
||||
* __LJMP marks a prototype of hlua file that can use longjmp.
|
||||
* WILL_LJMP() marks an lua function that will use longjmp.
|
||||
* MAY_LJMP() marks an lua function that may use longjmp.
|
||||
*/
|
||||
#define __LJMP
|
||||
#define WILL_LJMP(func) do { func; my_unreachable(); } while(0)
|
||||
#define MAY_LJMP(func) func
|
||||
|
||||
/* This couple of function executes securely some Lua calls outside of
|
||||
* the lua runtime environment. Each Lua call can return a longjmp
|
||||
|
|
|
|||
Loading…
Reference in a new issue