diff options
| author | Andi Gutmans <andi@php.net> | 2004-07-19 07:19:50 +0000 |
|---|---|---|
| committer | Andi Gutmans <andi@php.net> | 2004-07-19 07:19:50 +0000 |
| commit | 56f8195fe592e79d90c78fb015f39bffa7f39422 (patch) | |
| tree | 6a1bf69bc9cd23fab98c4d3d6c12368b56d26079 /Zend/zend_alloc.h | |
| parent | 599ae4b1b53d46e10447dab8fb4faa2d0517370a (diff) | |
| download | php-git-56f8195fe592e79d90c78fb015f39bffa7f39422.tar.gz | |
- Nuke empty_string. It is a reminanent from the time where RETURN_FALSE()
used to return "" and not bool(false). It's not worth keeping it because
STR_FREE() and zval_dtor() always have to check for it and it slows down
the general case. In addition, it seems that empty_string has been abused
quite a lot, and was used not only for setting zval's but generally in
PHP code instead of "", which wasn't the intention. Last but not least,
nuking empty_string should improve stability as I doubt every place
correctly checked if they are not mistakenly erealloc()'ing it or
calling efree() on it.
NOTE: Some code is probably broken. Each extension maintainer should
check and see that my changes are OK. Also, I haven't had time to touch
PECL yet. Will try and do it tomorrow.
Diffstat (limited to 'Zend/zend_alloc.h')
| -rw-r--r-- | Zend/zend_alloc.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 6e93d6abed..7521787ab8 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -119,8 +119,8 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE #define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size))) #define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s)) -#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string)) -#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string)) +#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC()) +#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC()) ZEND_API int zend_set_memory_limit(unsigned int memory_limit); |
