]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11903: Fix regression on Windows in switch_utils.h
authorAndrey Volk <andywolk@gmail.com>
Thu, 18 Jul 2019 20:31:46 +0000 (00:31 +0400)
committerAndrey Volk <andywolk@gmail.com>
Thu, 18 Jul 2019 20:33:21 +0000 (00:33 +0400)
src/include/switch_utils.h

index a810bf07f15e0d0907c0f150f867738a52efd442..21d4ae38ff8eca57ad2727d463d8dd02e5efbaf9 100644 (file)
@@ -1348,10 +1348,16 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai
 #define switch_strdup(ptr, s) (void)( (!!(ptr = strdup(s))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%d", __FILE__, __LINE__),abort(), 0), ptr)
 #endif
 #else
+#if (_MSC_VER >= 1500)            // VC9+
+#define switch_malloc(ptr, len) (void)(assert(((ptr) = malloc((len)))),ptr);__analysis_assume( ptr )
+#define switch_zmalloc(ptr, len) (void)(assert((ptr = calloc(1, (len)))),ptr);__analysis_assume( ptr )
+#define switch_strdup(ptr, s) (void)(assert(((ptr) = _strdup(s))),ptr);__analysis_assume( ptr )
+#else
 #define switch_malloc(ptr, len) (void)(switch_assert(((ptr) = malloc((len)))),ptr)
 #define switch_zmalloc(ptr, len) (void)(switch_assert((ptr = calloc(1, (len)))),ptr)
 #define switch_strdup(ptr, s) (void)(switch_assert(((ptr) = strdup((s)))),ptr)
 #endif
+#endif
 
 #define DUMP_EVENT(_e)         {char *event_str;switch_event_serialize(_e, &event_str, SWITCH_FALSE);switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DUMP\n%s\n", event_str);free(event_str);}