cvs: ZendEngine2 / zend_alloc.c zend_alloc.h

From: Date: Sun, 28 Apr 2002 06:24:16 +0000
Subject: cvs: ZendEngine2 / zend_alloc.c zend_alloc.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-80@lists.php.net to get a copy of this message
sebastian Sun Apr 28 02:24:16 2002 EDT Modified files: /ZendEngine2 zend_alloc.c zend_alloc.h Log: Revert. Index: ZendEngine2/zend_alloc.c diff -u ZendEngine2/zend_alloc.c:1.96 ZendEngine2/zend_alloc.c:1.97 --- ZendEngine2/zend_alloc.c:1.96 Sat Apr 27 11:23:46 2002 +++ ZendEngine2/zend_alloc.c Sun Apr 28 02:24:15 2002 @@ -248,6 +248,23 @@ } +ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) +{ + void *p; + int final_size = size*nmemb; + + HANDLE_BLOCK_INTERRUPTIONS(); + p = _emalloc(final_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); + if (!p) { + HANDLE_UNBLOCK_INTERRUPTIONS(); + return (void *) p; + } + memset(p, 0, final_size); + HANDLE_UNBLOCK_INTERRUPTIONS(); + return p; +} + + ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { zend_mem_header *p; Index: ZendEngine2/zend_alloc.h diff -u ZendEngine2/zend_alloc.h:1.35 ZendEngine2/zend_alloc.h:1.36 --- ZendEngine2/zend_alloc.h:1.35 Sat Apr 27 11:23:46 2002 +++ ZendEngine2/zend_alloc.h Sun Apr 28 02:24:15 2002 @@ -75,6 +75,7 @@ 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); @@ -93,7 +94,7 @@ /* Relay wrapper macros */ #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) memset(_emalloc((nmemb)*(size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC), 0, (nmemb)*(size)) +#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)

« previous php.zend-engine.cvs (#80) next »