ecore: do not rely on implicit rules for memory lifecycle during test.

Summary:
alloca force the memory to be accessible for the entire duration of the
scope of the function it is called from. This will garantee that the
memory pointer are not recycled under our feet before we check them.

T8020

Reviewers: zmike

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8020

Differential Revision: https://phab.enlightenment.org/D9127
This commit is contained in:
Cedric BAIL 2019-06-20 09:38:11 -04:00 committed by Mike Blumenkrantz
parent d46d1ed018
commit 42b293ae1f
1 changed files with 4 additions and 1 deletions

View File

@ -60,11 +60,14 @@ typedef struct _Race_Future_Ctx {
#define LOG_CTX_MULTIPLE_FUNC_CTX_SET(_ctx, ...) \
do { \
struct Func_Ctx tmp[] = { __VA_ARGS__, {NULL, NULL}}; \
\
_ctx.func_ctx = alloca(EINA_C_ARRAY_LENGTH(tmp) * sizeof (struct Func_Ctx)); \
memcpy(_ctx.func_ctx, tmp, sizeof (tmp)); \
_ctx.level = EINA_LOG_LEVEL_ERR; \
_ctx.did = EINA_FALSE; \
_ctx.just_fmt = EINA_FALSE; \
_ctx.func_ctx_idx = 0; \
_ctx.func_ctx = (struct Func_Ctx []){ __VA_ARGS__, {NULL, NULL}}; \
} while(0)
#define LOG_CTX_SET(_ctx, _fnc, _msg) LOG_CTX_MULTIPLE_FUNC_CTX_SET(_ctx, {_fnc, _msg})