Constant value as a zval*
| From: | Andrei Zmievski | Date: | Wed, 26 May 2004 21:04:20 +0000 |
| Subject: | Constant value as a zval* | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10103@lists.php.net to get a copy of this message | ||
This reminds me: why do we have constant value as a regular zval instead
of zval*? On every constant fetch we are invoking a copy constructor and
that can add up in applications that use a lot of constants, PEAR-based
ones especially. I don't see any compeling architectural reason for it.
Andi, Zeev?
On Wed, 26 May 2004, Andrei Zmievski wrote:
> andrei Wed May 26 17:02:12 2004 EDT
>
> Modified files: (Branch: PHP_4_3)
> /Zend zend_constants.c
> Log:
> Make sure zend_get_constant() result is initialized properly.
>
>
>
> http://cvs.php.net/diff.php/Zend/zend_constants.c?r1=1.42.2.4&r2=1.42.2.5&ty=u
> Index: Zend/zend_constants.c
> diff -u Zend/zend_constants.c:1.42.2.4 Zend/zend_constants.c:1.42.2.5
> --- Zend/zend_constants.c:1.42.2.4 Wed May 26 16:50:51 2004
> +++ Zend/zend_constants.c Wed May 26 17:02:12 2004
> @@ -237,6 +237,8 @@
> if (retval) {
> *result = c->value;
> zval_copy_ctor(result);
> + result->is_ref = 0;
> + result->refcount = 1;
> }
>
> return retval;
>
> --
> Zend Engine CVS Mailing List (http://cvs.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
- Andrei