aboutsummaryrefslogtreecommitdiff
path: root/portability.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-09-03 18:37:54 -0700
committerGuy Harris <guy@alum.mit.edu>2017-09-03 18:37:54 -0700
commit809478fe163f4987876d323fd91ba3664ecd4e74 (patch)
tree200808332cad347067d05ebd2927ce9b9d604556 /portability.h
parent469e429c64d764e9aed2218eed1fde7241a06e39 (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.h8
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