From 61c50e9d1cf2644b231141fc660bc5fb1f9cf65f Mon Sep 17 00:00:00 2001 From: Boris 'billiob' Faure Date: Wed, 20 Mar 2013 21:18:49 +0100 Subject: [PATCH] eina-cow: fix valgrind instrumentation --- src/lib/eina/eina_cow.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/eina/eina_cow.c b/src/lib/eina/eina_cow.c index 397f853dfb..55125906e2 100644 --- a/src/lib/eina/eina_cow.c +++ b/src/lib/eina/eina_cow.c @@ -484,8 +484,15 @@ eina_cow_done(Eina_Cow *cow, if (!needed_gc) return ; +#ifndef NVALGRIND + VALGRIND_MAKE_MEM_DEFINED(ref, sizeof (*ref)); +#endif /* needed if we want to make cow gc safe */ if (ref->togc) return ; +#ifndef NVALGRIND + VALGRIND_MAKE_MEM_NOACCESS(ref, sizeof (*ref)); +#endif + gc = eina_mempool_malloc(gc_pool, sizeof (Eina_Cow_GC)); if (!gc) return ; /* That one will not get gced this time */ @@ -493,10 +500,10 @@ eina_cow_done(Eina_Cow *cow, gc->ref = ref; gc->dst = dst; eina_hash_direct_add(cow->togc, &gc->ref, gc); - ref->togc = EINA_TRUE; #ifndef NVALGRIND VALGRIND_MAKE_MEM_DEFINED(ref, sizeof (*ref)); #endif + ref->togc = EINA_TRUE; #ifndef NVALGRIND VALGRIND_MAKE_MEM_NOACCESS(ref, sizeof (*ref)); #endif