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 /ext/session/session.c | |
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 'ext/session/session.c')
-rw-r--r-- | ext/session/session.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/session/session.c b/ext/session/session.c index 135a732253..f5efc8ba9d 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1060,7 +1060,7 @@ static void php_session_reset_id(TSRMLS_D) smart_str_0(&var); REGISTER_STRINGL_CONSTANT("SID", var.c, var.len, 0); } else { - REGISTER_STRINGL_CONSTANT("SID", empty_string, 0, 0); + REGISTER_STRINGL_CONSTANT("SID", "", 0, 1); } if (PS(apply_trans_sid)) { @@ -1370,13 +1370,16 @@ PHP_FUNCTION(session_id) { zval **p_name; int ac = ZEND_NUM_ARGS(); - char *old = empty_string; + char *old; if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; - if (PS(id)) + if (PS(id)) { old = estrdup(PS(id)); + } else { + old = STR_EMPTY_ALLOC(); + } if (ac == 1) { convert_to_string_ex(p_name); |