From 63f47f170ac62ce2fb0d3801e67a75e37b187d24 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Mon, 7 Sep 2015 05:08:56 +0200 Subject: [PATCH] Added zero-filling code for assert stats before sending them to the monitoring process --- include/criterion/assert.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/criterion/assert.h b/include/criterion/assert.h index 2111409..bf9e7fe 100644 --- a/include/criterion/assert.h +++ b/include/criterion/assert.h @@ -60,6 +60,12 @@ struct criterion_assert_args { # define CR_GET_CONDITION_STR(Condition, ...) #Condition # define CR_VA_SKIP(_, ...) __VA_ARGS__ +# ifndef __cplusplus +# define CR_ZERO_FILL(Arg) memset(&(Arg), 0, sizeof (Arg)) +# else +# define CR_ZERO_FILL(Arg) std::memset(&(Arg), 0, sizeof (Arg)) +# endif + # define cr_assert_impl(Kind, ...) \ do { \ struct criterion_assert_args args = { \ @@ -67,6 +73,7 @@ struct criterion_assert_args { }; \ int passed = !!(CR_EXPAND(CR_GET_CONDITION(__VA_ARGS__))); \ struct criterion_assert_stats stat; \ + CR_ZERO_FILL(stat); \ stat.kind = (Kind); \ stat.condition = CR_EXPAND(CR_GET_CONDITION_STR(__VA_ARGS__)); \ stat.message = args.msg ? args.msg : ""; \