summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_alloc.h')
-rw-r--r--Zend/zend_alloc.h57
1 files changed, 29 insertions, 28 deletions
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
index f64d86c1b7..d6e2b3b809 100644
--- a/Zend/zend_alloc.h
+++ b/Zend/zend_alloc.h
@@ -34,6 +34,8 @@ typedef struct _mem_header {
char *filename;
uint lineno;
int reported;
+ char *orig_filename;
+ uint orig_lineno;
#endif
struct _mem_header *pNext;
struct _mem_header *pLast;
@@ -58,33 +60,33 @@ ZEND_API char *zend_strndup(const char *s, unsigned int length);
BEGIN_EXTERN_C()
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC);
-ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC);
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC);
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC);
-ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC);
-ZEND_API void _persist_alloc(void *ptr ZEND_FILE_LINE_DC);
+ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void _persist_alloc(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
/* Standard wrapper macros */
-#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC)
-#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC)
-#define ecalloc(nmemb,size) _ecalloc((nmemb),(size) ZEND_FILE_LINE_CC)
-#define erealloc(ptr,size) _erealloc((ptr),(size),0 ZEND_FILE_LINE_CC)
-#define erealloc_recoverable(ptr,size) _erealloc((ptr),(size),1 ZEND_FILE_LINE_CC)
-#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC)
-#define estrndup(s,length) _estrndup((s),(length) ZEND_FILE_LINE_CC)
-#define persist_alloc(p) _persist_alloc((p) ZEND_FILE_LINE_CC)
+#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define ecalloc(nmemb,size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define erealloc(ptr,size) _erealloc((ptr), (size),0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define erealloc_recoverable(ptr,size) _erealloc((ptr), (size),1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define estrndup(s,length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define persist_alloc(p) _persist_alloc((p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
/* Relay wrapper macros */
-#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC)
-#define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC)
-#define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC)
-#define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC)
-#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC)
-#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC)
-#define estrndup_rel(s, length) _estrndup((s) ZEND_FILE_LINE_RELAY_CC)
-#define persist_alloc_rel(p) _persist_alloc((p) ZEND_FILE_LINE_RELAY_CC)
+#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
+#define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
+#define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
+#define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
+#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
+#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
+#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
+#define persist_alloc_rel(p) _persist_alloc((p) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
/* Selective persistent/non persistent allocation macros */
#define pemalloc(size,persistent) ((persistent)?malloc(size):emalloc(size))
@@ -103,11 +105,10 @@ ZEND_API void start_memory_manager(void);
ZEND_API void shutdown_memory_manager(int silent, int clean_cache);
#if ZEND_DEBUG
-ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC);
-ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC);
-#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC)
-#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC)
-#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC)
+ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#else
#define mem_block_check(type, ptr, silent)
#define full_mem_check(silent)