diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2019-06-20 09:38:11 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-06-20 09:40:34 -0400 |
commit | 42b293ae1f89aa3737fe7a4d81ebc3596fd2c631 (patch) | |
tree | 54a6e9351aff4fd74602856db9728658b130550c | |
parent | d46d1ed0181d787c84486e920b46b30b1af07bcd (diff) | |
download | efl-42b293ae1f89aa3737fe7a4d81ebc3596fd2c631.tar.gz |
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
-rw-r--r-- | src/tests/ecore/efl_app_test_promise.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tests/ecore/efl_app_test_promise.c b/src/tests/ecore/efl_app_test_promise.c index 1a9019368d..8a7b3edd16 100644 --- a/src/tests/ecore/efl_app_test_promise.c +++ b/src/tests/ecore/efl_app_test_promise.c @@ -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}) |