Re: Constant value as a zval*

From: Date: Thu, 27 May 2004 06:13:53 +0000
Subject: Re: Constant value as a zval*
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-10105@lists.php.net to get a copy of this message
I don't think there's a good reason especially as I used zval * for class constants. Probably just because it's legacy code and it was never changed. I'll try and play around with it right after 5.0. Andi At 02:04 PM 5/26/2004 -0700, Andrei Zmievski wrote:
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


« previous php.internals (#10105) next »