zmike pushed a commit to branch efl-1.22.

http://git.enlightenment.org/core/efl.git/commit/?id=6ef3e8ed006c507d45fb6a405c095c084d672ce0

commit 6ef3e8ed006c507d45fb6a405c095c084d672ce0
Author: Cedric BAIL <cedric.b...@free.fr>
Date:   Thu Jun 20 09:38:11 2019 -0400

    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
---
 src/tests/ecore/efl_app_test_promise.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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})

-- 


Reply via email to