Commit 3dab807e authored by gropp's avatar gropp
Browse files

Fix for strdup when memory tracing is enabled

parent ae932c13
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
/* Make sure that we have the definitions for the malloc routines and size_t */ /* Make sure that we have the definitions for the malloc routines and size_t */
#include <stdlib.h> #include <stdlib.h>
/* strdup is often declared in string.h, so if we plan to redefine strdup,
we need to include string first. That is done below, only in the
case where we redefine strdup */
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
...@@ -218,6 +221,10 @@ int MPIU_Str_get_string(char **str_ptr, char *val, int maxlen); ...@@ -218,6 +221,10 @@ int MPIU_Str_get_string(char **str_ptr, char *val, int maxlen);
#if defined(strdup) || defined(__strdup) #if defined(strdup) || defined(__strdup)
#undef strdup #undef strdup
#endif #endif
/* We include string.h first, so that if it contains a definition of
strdup, we won't have an obscure failure when a file include string.h
later in the compilation process. */
#include <string.h>
/* The ::: should cause the compiler to choke; the string /* The ::: should cause the compiler to choke; the string
will give the explanation */ will give the explanation */
#define strdup(a) 'Error use MPIU_Strdup' ::: #define strdup(a) 'Error use MPIU_Strdup' :::
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment