diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-09-03 18:37:54 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-09-03 18:37:54 -0700 |
commit | 809478fe163f4987876d323fd91ba3664ecd4e74 (patch) | |
tree | 200808332cad347067d05ebd2927ce9b9d604556 /portability.h | |
parent | 469e429c64d764e9aed2218eed1fde7241a06e39 (diff) |
We may have to define strdup even if _DEBUG is defined.
If <crtdbg.h> hasn't been included, even if _DEBUG is defined, strdup()
won't be defined to call _strdup_dbg(), so, instead of checking for
_DEBUG, check whether strdup has already been defined.
Diffstat (limited to 'portability.h')
-rw-r--r-- | portability.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/portability.h b/portability.h index 179ecd92..4061a1d4 100644 --- a/portability.h +++ b/portability.h @@ -88,7 +88,13 @@ extern "C" { #endif #ifdef _MSC_VER - #ifndef _DEBUG + /* + * If <crtdbg.h> has been included, and _DEBUG is defined, and + * __STDC__ is zero, <crtdbg.h> will define strdup() to call + * _strdup_dbg(). So if it's already defined, don't redefine + * it. + */ + #ifndef strdup #define strdup _strdup #endif #define sscanf sscanf_s |