--- rpl/src/rpl.h 2019/11/14 18:54:48 1.338 +++ rpl/src/rpl.h 2020/01/16 08:57:42 1.340 @@ -1,7 +1,7 @@ /* ================================================================================ RPL/2 (R) version 4.1.32 - Copyright (C) 1989-2019 Dr. BERTRAND Joël + Copyright (C) 1989-2020 Dr. BERTRAND Joël This file is part of RPL/2. @@ -20,6 +20,7 @@ */ +#define DEBUG_MEMOIRE #ifndef INCLUSION_RPL #define INCLUSION_RPL @@ -731,10 +732,28 @@ void *debug_memoire_modification(void *p void debug_memoire_retrait(void *ptr); void debug_memoire_verification(); -#define malloc(s) debug_memoire_ajout(s, __FUNCTION__, __LINE__, #s) #define free(s) debug_memoire_retrait(s) -#define realloc(s, t) debug_memoire_modification(s, t, \ - __FUNCTION__, __LINE__, #t) +#ifdef RPLCXX +# define malloc(s) debug_memoire_ajout(s, \ + const_cast \ + (reinterpret_cast \ + (const_cast(__FUNCTION__))), __LINE__, \ + const_cast \ + (reinterpret_cast \ + (const_cast(#s)))) +# define realloc(s, t) debug_memoire_modification(s, t, \ + const_cast \ + (reinterpret_cast \ + (const_cast(__FUNCTION__))), __LINE__, \ + const_cast \ + (reinterpret_cast \ + (const_cast(#t)))) +#else +# define malloc(s) debug_memoire_ajout(s, __FUNCTION__, __LINE__, \ + (const unsigned char *) #s) +# define realloc(s, t) debug_memoire_modification(s, t, \ + __FUNCTION__, __LINE__, (const unsigned char *) #t) +#endif #define fork() debug_fork(s_etat_processus) #endif