handshake: use _hs directly in handshake_event
James Prestwood
PATCH 1/1 handshake: use _hs directly in handshake_event
Certain platforms/compilers were having issues with using the 'hs' local in this macro (likely has something to do with the caller also using a local 'hs' variable name). This caused a crash on these platforms. Using the macro argument _hs directly fixes the crash.
--- src/handshake.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
src/handshake.h +6 -7
@@ -166,19 +166,18 @@ struct handshake_state {#define handshake_event (_hs, event, ...) \ (__extension__ ({ \ - struct handshake_state *hs = (_hs); \ bool freed = false; \ \ - if (hs->event_func && !hs->in_event) { \ - hs->in_event = true; \ - hs->event_func(hs, event, hs->user_data, \ + if ((_hs)->event_func && !(_hs)->in_event) { \ + (_hs)->in_event = true; \ + (_hs)->event_func((_hs), event, (_hs)->user_data, \ ##__VA_ARGS__); \ \ - if (!hs->in_event) { \ - handshake_state_free(hs); \ + if (!(_hs)->in_event) { \ + handshake_state_free((_hs)); \ freed = true; \ } else \ - hs->in_event = false; \ + (_hs)->in_event = false; \ } \ freed; \ }))
Signature · 1 line
2.31.1
Denis Kenzior
AppliedHi James,
Quoted 8 lines · James Prestwood
Certain platforms/compilers were having issues with using the 'hs' local in this macro (likely has something to do with the caller also using a local 'hs' variable name). This caused a crash on these platforms. Using the macro argument
_hsdirectly fixes the crash.--- src/handshake.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
Applied, thanks.
Regards,
-Denis