]> The Tcpdump Group git mirrors - libpcap/commitdiff
Merge pull request #568 from gvanem/master
authorGuy Harris <[email protected]>
Sun, 19 Mar 2017 22:13:57 +0000 (15:13 -0700)
committerGitHub <[email protected]>
Sun, 19 Mar 2017 22:13:57 +0000 (15:13 -0700)
MSVC's strdup() in _DEBUG mode

1  2 
portability.h

diff --combined portability.h
index d4343e62d564398b75be95f0add252c29ffb439b,f050ffa2720de4fee2343f353f22d0d790bf9500..179ecd92d70bb09db83c7d6164269c93c7064828
@@@ -39,8 -39,6 +39,8 @@@
   * flavors of UN*X.
   */
  
 +#include "funcattrs.h"
 +
  #ifdef __cplusplus
  extern "C" {
  #endif
   #endif
  #endif
  
 -/*
 - * For flagging arguments as format strings in MSVC.
 - */
 -#if _MSC_VER >= 1400
 - #include <sal.h>
 - #if _MSC_VER > 1400
 -  #define FORMAT_STRING(p) _Printf_format_string_ p
 - #else
 -  #define FORMAT_STRING(p) __format_string p
 - #endif
 -#else
 - #define FORMAT_STRING(p) p
 -#endif
 -
  #ifdef _MSC_VER
+   #ifndef _DEBUG
    #define strdup      _strdup
+   #endif
    #define sscanf      sscanf_s
    #define setbuf(x, y) \
        setvbuf((x), (y), _IONBF, 0)
  #ifdef HAVE_SNPRINTF
  #define pcap_snprintf snprintf
  #else
 -extern int pcap_snprintf(char *, size_t, FORMAT_STRING(const char *), ...)
 -#ifdef __ATTRIBUTE___FORMAT_OK
 -    __attribute__((format (printf, 3, 4)))
 -#endif /* __ATTRIBUTE___FORMAT_OK */
 -    ;
 +extern int pcap_snprintf(char *, size_t, PCAP_FORMAT_STRING(const char *), ...)
 +    PCAP_PRINTFLIKE(3, 4);
  #endif
  
  #ifdef HAVE_VSNPRINTF