mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
add a proxy for sppintf and vspprintf
This commit is contained in:
parent
c90df5850b
commit
f06443593e
7 changed files with 80 additions and 52 deletions
|
@ -510,6 +510,35 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ _mysqlnd_sprintf */
|
||||
PHPAPI int _mysqlnd_sprintf(char ** pbuf, size_t max_len, const char *format, ...)
|
||||
{
|
||||
int len;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
len = vspprintf(pbuf, max_len, format, ap);
|
||||
va_end(ap);
|
||||
return len;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ _mysqlnd_sprintf_free */
|
||||
PHPAPI void _mysqlnd_sprintf_free(char * p)
|
||||
{
|
||||
efree(p);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
PHPAPI int _mysqlnd_vsprintf(char ** pbuf, size_t max_len, const char * format, va_list ap)
|
||||
{
|
||||
return vspprintf(pbuf, max_len, format, ap);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
#define MYSQLND_DEBUG_MEMORY 1
|
||||
|
||||
#if MYSQLND_DEBUG_MEMORY == 0
|
||||
|
@ -644,7 +673,10 @@ PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
|
|||
_mysqlnd_realloc,
|
||||
_mysqlnd_free,
|
||||
_mysqlnd_pestrndup,
|
||||
_mysqlnd_pestrdup
|
||||
_mysqlnd_pestrdup,
|
||||
_mysqlnd_sprintf,
|
||||
_mysqlnd_vsprintf,
|
||||
_mysqlnd_sprintf_free
|
||||
#else
|
||||
mysqlnd_zend_mm_emalloc,
|
||||
mysqlnd_zend_mm_pemalloc,
|
||||
|
@ -660,6 +692,8 @@ PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
|
|||
mysqlnd_zend_mm_free,
|
||||
mysqlnd_zend_mm_pestrndup,
|
||||
mysqlnd_zend_mm_pestrdup
|
||||
sprintf,
|
||||
mysqlnd_zend_mm_efree,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue