mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 21:22:09 +00:00
FSCORE-617
This commit is contained in:
@@ -22,7 +22,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* options that are useful for constructing SQL statements.
|
||||
*
|
||||
* The strings returned by this routine should be freed by calling
|
||||
* switch_core_db_free().
|
||||
* free().
|
||||
*
|
||||
* All of the usual printf formatting options apply. In addition, there
|
||||
* is a "%q" option. %q works like %s in that it substitutes a null-terminated
|
||||
@@ -37,9 +37,9 @@ SWITCH_BEGIN_EXTERN_C
|
||||
*
|
||||
* We can use this text in an SQL statement as follows:
|
||||
*
|
||||
* char *z = switch_core_db_mprintf("INSERT INTO TABLES('%q')", zText);
|
||||
* char *z = switch_mprintf("INSERT INTO TABLES('%q')", zText);
|
||||
* switch_core_db_exec(db, z, callback1, 0, 0);
|
||||
* switch_core_db_free(z);
|
||||
* free(z);
|
||||
*
|
||||
* Because the %q format string is used, the '\'' character in zText
|
||||
* is escaped and the SQL generated is as follows:
|
||||
|
||||
@@ -653,14 +653,17 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai
|
||||
/* malloc or DIE macros */
|
||||
#ifdef NDEBUG
|
||||
#define switch_malloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr )
|
||||
#define switch_zmalloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), memset(ptr, 0, len))
|
||||
#define switch_zmalloc(ptr, len) (void)( (!!(ptr = calloc(1, (len)))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
|
||||
#define switch_strdup(ptr, s) (void)( (!!(ptr = strdup(s))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
|
||||
#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 = malloc(len))),memset(ptr, 0, len));__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)((len)))),ptr);__analysis_assume( ptr )
|
||||
#else
|
||||
#define switch_malloc(ptr, len) (void)(assert(((ptr) = malloc((len)))),ptr)
|
||||
#define switch_zmalloc(ptr, len) (void)(assert((ptr = malloc(len))),memset(ptr, 0, len))
|
||||
#define switch_zmalloc(ptr, len) (void)(assert((ptr = calloc(1, (len)))),ptr)
|
||||
#define switch_strdup(ptr, s) (void)(assert(((ptr) = strdup((s)))),ptr)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user