From ce93c00a7bd1213717425c6ae6ba855a537e6a06 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Tue, 16 Jul 2019 23:21:41 +0200 Subject: [PATCH] Workaround limitation of M_MOVE_DEFAULT for [1] structure (==> It supposes now that the destination parameter is **not** a type with [1] tricks or at least not a pointer to it, instead of having this constraint for both arguments). --- m-core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m-core.h b/m-core.h index 4582b8f0..3d756705 100644 --- a/m-core.h +++ b/m-core.h @@ -2153,7 +2153,7 @@ m_core_hash (const void *str, size_t length) /* NOTE: Theses operators are NOT compatible with the '[1]' tricks if the variable is defined as a parameter of a function (sizeof (a) is not portable). */ -#define M_MOVE_DEFAULT(a,b) (M_MEMCPY_DEFAULT(a, b), M_MEMSET_DEFAULT(b)) +#define M_MOVE_DEFAULT(a,b) (M_MEMCPY_DEFAULT(a, b), memset(&(b), 0, sizeof (a))) #define M_MEMCPY_DEFAULT(a,b) (memcpy(&(a), &(b), sizeof (a))) #define M_MEMSET_DEFAULT(a) (memset(&(a), 0, sizeof (a))) #define M_MEMCMP1_DEFAULT(a,b) (memcmp(&(a), &(b), sizeof (a)) == 0)