diff options
author | Andrey Hristov <andrey@php.net> | 2010-03-29 17:04:16 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2010-03-29 17:04:16 +0000 |
commit | 94cd357f5b4a2533510e382e08861269f57602e0 (patch) | |
tree | 65d0d2b969cd8f31eb6af1fbe908c9db965224f1 /ext/mysqlnd/mysqlnd_debug.h | |
parent | e99039d69269445ea7a786cff6086a314d301da0 (diff) | |
download | php-git-94cd357f5b4a2533510e382e08861269f57602e0.tar.gz |
Make it coupled - what is allocated with mnd_ should be freed
with mnd_ and vice versa.
Added mnd_pestrndup and mnd_pestrdup, which wrap the normal
calls to be able to track this calls.
Fixed some failing tests.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_debug.h')
-rw-r--r-- | ext/mysqlnd/mysqlnd_debug.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h index 96c953c24d..dc9d0a7dfb 100644 --- a/ext/mysqlnd/mysqlnd_debug.h +++ b/ext/mysqlnd/mysqlnd_debug.h @@ -63,7 +63,7 @@ PHPAPI extern const char * mysqlnd_debug_std_no_trace_funcs[]; PHPAPI MYSQLND_DEBUG * mysqlnd_debug_init(const char * skip_functions[] TSRMLS_DC); #define MYSQLND_MEM_D TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC - +#define MYSQLND_MEM_C TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC PHPAPI void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D); PHPAPI void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D); @@ -76,7 +76,9 @@ PHPAPI void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D); PHPAPI void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D); PHPAPI void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D); PHPAPI void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D); -PHPAPI void _mysqlnd_free(void *ptr MYSQLND_MEM_D); +PHPAPI void _mysqlnd_free(void *ptr MYSQLND_MEM_D); +PHPAPI char * _mysqlnd_pestrndup(const char * const ptr, size_t size, zend_bool persistent MYSQLND_MEM_D); +PHPAPI char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_MEM_D); PHPAPI char * mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC); @@ -129,18 +131,20 @@ static inline void DBG_ENTER(const char * const func_name) {} #if MYSQLND_DEBUG_MEMORY -#define mnd_emalloc(size) _mysqlnd_emalloc((size) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_pemalloc(size, pers) _mysqlnd_pemalloc((size), (pers) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_ecalloc(nmemb, size) _mysqlnd_ecalloc((nmemb), (size) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_pecalloc(nmemb, size, p) _mysqlnd_pecalloc((nmemb), (size), (p) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_erealloc(ptr, new_size) _mysqlnd_erealloc((ptr), (new_size) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_perealloc(ptr, new_size, p) _mysqlnd_perealloc((ptr), (new_size), (p) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_efree(ptr) _mysqlnd_efree((ptr) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_pefree(ptr, pers) _mysqlnd_pefree((ptr), (pers) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_malloc(size) _mysqlnd_malloc((size) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_calloc(nmemb, size) _mysqlnd_calloc((nmemb), (size) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_realloc(ptr, new_size) _mysqlnd_realloc((ptr), (new_size) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define mnd_free(ptr) _mysqlnd_free((ptr) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) +#define mnd_emalloc(size) _mysqlnd_emalloc((size) MYSQLND_MEM_C) +#define mnd_pemalloc(size, pers) _mysqlnd_pemalloc((size), (pers) MYSQLND_MEM_C) +#define mnd_ecalloc(nmemb, size) _mysqlnd_ecalloc((nmemb), (size) MYSQLND_MEM_C) +#define mnd_pecalloc(nmemb, size, p) _mysqlnd_pecalloc((nmemb), (size), (p) MYSQLND_MEM_C) +#define mnd_erealloc(ptr, new_size) _mysqlnd_erealloc((ptr), (new_size) MYSQLND_MEM_C) +#define mnd_perealloc(ptr, new_size, p) _mysqlnd_perealloc((ptr), (new_size), (p) MYSQLND_MEM_C) +#define mnd_efree(ptr) _mysqlnd_efree((ptr) MYSQLND_MEM_C) +#define mnd_pefree(ptr, pers) _mysqlnd_pefree((ptr), (pers) MYSQLND_MEM_C) +#define mnd_malloc(size) _mysqlnd_malloc((size) MYSQLND_MEM_C) +#define mnd_calloc(nmemb, size) _mysqlnd_calloc((nmemb), (size) MYSQLND_MEM_C) +#define mnd_realloc(ptr, new_size) _mysqlnd_realloc((ptr), (new_size) MYSQLND_MEM_C) +#define mnd_free(ptr) _mysqlnd_free((ptr) MYSQLND_MEM_C) +#define mnd_pestrndup(ptr, size, pers) _mysqlnd_pestrndup((ptr), (size), (pers) MYSQLND_MEM_C) +#define mnd_pestrdup(ptr, pers) _mysqlnd_pestrdup((ptr), (pers) MYSQLND_MEM_C) #else @@ -156,6 +160,8 @@ static inline void DBG_ENTER(const char * const func_name) {} #define mnd_calloc(nmemb, size) calloc((nmemb), (size)) #define mnd_realloc(ptr, new_size) realloc((ptr), (new_size)) #define mnd_free(ptr) free((ptr)) +#define mnd_pestrndup(ptr, size, pers) pestrndup((ptr), (size), (pers)) +#define mnd_pestrndup(ptr, size, pers) pestrdup((ptr), (pers)) #endif |