Re: [PHP4BETA] cvs: /php4/ext/hyperwave hw.c /php4/ext/pcre php_pcre.c /php4/ext/session session.c /php4/ext/standard array.c /php4/ext/wddx wddx.c
/php4/sapi/isapi php4isapi.c

From: Date: Fri, 24 Dec 1999 17:37:22 +0000
Subject: Re: [PHP4BETA] cvs: /php4/ext/hyperwave hw.c /php4/ext/pcre php_pcre.c /php4/ext/session session.c /php4/ext/standard array.c /php4/ext/wddx wddx.c
/php4/sapi/isapi php4isapi.c
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-8489@lists.php.net to get a copy of this message
OK I'm going to commit the move to ALLOC_ZVAL() in a minute. The tough part is finding the places where we need to substitute the FREE_ZVAL(z). I did this for Zend but doing it for all of the modules will take some time. Andi At 05:23 PM 12/24/99 +0100, Thies C. Arntzen wrote:
find php4 -type f -exec grep "sizeof([pz]val)" {} \; -print shows a few more. i think i can smell a smarter zval-allocation cache around the corner... i was going to suggest something like that (maybe even have a ALLOC_HASHTABLE()?) happy christmas! tc On Fri, 24 Dec 1999, Andi Gutmans wrote:
andi          Fri Dec 24 10:44:09 1999 EDT
Modified files:
    /php4/ext/hyperwave       hw.c
    /php4/ext/pcre    php_pcre.c
    /php4/ext/session session.c
    /php4/ext/standard        array.c
    /php4/ext/wddx    wddx.c
    /php4/sapi/isapi  php4isapi.c
Log: - Use ALLOC_ZVAL() in PHP. Finding the places to put FREE_ZVAL(z) is much
    more tricky and I'm not sure how many places this is. zval allocations
    were only made directly in 11 places.
Index: php4/ext/hyperwave/hw.c diff -u php4/ext/hyperwave/hw.c:1.34 php4/ext/hyperwave/hw.c:1.35
--- php4/ext/hyperwave/hw.c:1.34      Sat Dec 18 17:35:05 1999
+++ php4/ext/hyperwave/hw.c Fri Dec 24 10:43:36 1999 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: hw.c,v 1.34 1999/12/18 22:35:05 zeev Exp $ */ +/* $Id: hw.c,v 1.35 1999/12/24 15:43:36 andi Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif @@ -1175,7 +1175,7 @@
      while(attrname != NULL) {
              char *name;
-             user_arr = (zval *) emalloc(sizeof(zval));
+             user_arr = ALLOC_ZVAL();
              if (array_init(user_arr) == FAILURE) {
                      efree(object);
                      RETURN_FALSE;
Index: php4/ext/pcre/php_pcre.c diff -u php4/ext/pcre/php_pcre.c:1.34 php4/ext/pcre/php_pcre.c:1.35
--- php4/ext/pcre/php_pcre.c:1.34     Mon Dec 20 15:49:56 1999
+++ php4/ext/pcre/php_pcre.c Fri Dec 24 10:43:36 1999 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.34 1999/12/20 20:49:56 andrei Exp $ */ +/* $Id: php_pcre.c,v 1.35 1999/12/24 15:43:36 andi Exp $ */ /*
      TODO:
@@ -393,7 +393,7 @@
      if (global && subpats_order_val == PREG_PATTERN_ORDER) {
              match_sets = (zval **)emalloc(num_subpats * sizeof(zval *));
              for (i=0; i<num_subpats; i++) {
-                     match_sets[i] = (zval *)emalloc(sizeof(zval));
+                     match_sets[i] = ALLOC_ZVAL();
                      array_init(match_sets[i]);
                      INIT_PZVAL(match_sets[i]);
              }
@@ -441,7 +441,7 @@
                                      }
                                      else {
                                              /* Allocate the result set array */
-                                             result_set = emalloc(sizeof(zval));
+                                             result_set = ALLOC_ZVAL();
                                              array_init(result_set);
                                              INIT_PZVAL(result_set);
Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.87 php4/ext/session/session.c:1.88 --- php4/ext/session/session.c:1.87 Tue Dec 21 19:38:04 1999
+++ php4/ext/session/session.c        Fri Dec 24 10:43:37 1999
@@ -176,7 +176,7 @@
      PLS_FETCH();
      ELS_FETCH();
-     state_val_copy = (zval *)emalloc(sizeof(zval));
+     state_val_copy = ALLOC_ZVAL();
      *state_val_copy = *state_val;
      zval_copy_ctor(state_val_copy);
      state_val_copy->refcount = 0;
Index: php4/ext/standard/array.c diff -u php4/ext/standard/array.c:1.17 php4/ext/standard/array.c:1.18
--- php4/ext/standard/array.c:1.17    Tue Dec 21 12:14:31 1999
+++ php4/ext/standard/array.c Fri Dec 24 10:43:38 1999 @@ -1059,7 +1059,7 @@
              if (zend_hash_find(eg_active_symbol_table, entry->value.str.val,
entry->value.str.len+1, (void **)&value_ptr) != FAILURE) {
                      value = *value_ptr;
-                     data = (zval *)emalloc(sizeof(zval));
+                     data = ALLOC_ZVAL();
                      *data = *value;
                      zval_copy_ctor(data);
                      INIT_PZVAL(data);
Index: php4/ext/wddx/wddx.c diff -u php4/ext/wddx/wddx.c:1.17 php4/ext/wddx/wddx.c:1.18 --- php4/ext/wddx/wddx.c:1.17 Sat Dec 18 17:35:31 1999
+++ php4/ext/wddx/wddx.c      Fri Dec 24 10:43:38 1999
@@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: wddx.c,v 1.17 1999/12/18 22:35:31 zeev Exp $ */ +/* $Id: wddx.c,v 1.18 1999/12/24 15:43:38 andi Exp $ */ #include "php.h" #include "php_wddx.h" @@ -468,7 +468,7 @@
              } else
                      ent.varname = NULL;
-             ent.data = (zval *)emalloc(sizeof(zval));
+             ent.data = ALLOC_ZVAL();
              ent.data->value.str.val = NULL;
              ent.data->value.str.len = 0;
              INIT_PZVAL(ent.data);
@@ -492,7 +492,7 @@
              } else
                      ent.varname = NULL;
-             ent.data = (zval *)emalloc(sizeof(zval));
+             ent.data = ALLOC_ZVAL();
              INIT_PZVAL(ent.data);
              wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
      } else if (!strcmp(name, EL_ARRAY)) {
@@ -504,7 +504,7 @@
              } else
                      ent.varname = NULL;
-             ent.data = (zval *)emalloc(sizeof(zval));
+             ent.data = ALLOC_ZVAL();
              array_init(ent.data);
              INIT_PZVAL(ent.data);
              wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
@@ -517,7 +517,7 @@
              } else
                      ent.varname = NULL;
-             ent.data = (zval *)emalloc(sizeof(zval));
+             ent.data = ALLOC_ZVAL();
              array_init(ent.data);
              INIT_PZVAL(ent.data);
              wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
Index: php4/sapi/isapi/php4isapi.c diff -u php4/sapi/isapi/php4isapi.c:1.7 php4/sapi/isapi/php4isapi.c:1.8 --- php4/sapi/isapi/php4isapi.c:1.7 Mon Dec 20 18:09:52 1999
+++ php4/sapi/isapi/php4isapi.c       Fri Dec 24 10:43:39 1999
@@ -407,7 +407,7 @@
              if (colon) {
                      char *value = colon+1;
-                     zval *entry = (zval *) emalloc(sizeof(zval));
+                     zval *entry = ALLOC_ZVAL();
                      while (*value==' ') {
                              value++;
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
Thies C. Arntzen                 "One Big-Mac, Small Fries and a Coke!"
Digital Collections             Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93                              20097 Hamburg / Germany
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.version4 (#8489) next »