[PHP-DEV] CVS update: php3 From: andi (php-dev <email protected>)
Date: 06/04/98

Date: Thursday June 4, 1998 @ 11:13
Author: andi

Update of /repository/php3
In directory asf:/tmp/cvs-serv2688

Modified Files:
        operators.c
Log Message:
Make concat() a tiny bit faster. It went from 7.6 seconds -> 4.9 seconds for me.
It still needs a major 3.1 upgrade though

Index: php3/operators.c
diff -c php3/operators.c:1.88 php3/operators.c:1.89
*** php3/operators.c:1.88 Sat May 23 17:33:11 1998
--- php3/operators.c Thu Jun 4 11:13:13 1998
***************
*** 29,35 ****
   */
  
  
! /* $Id: operators.c,v 1.88 1998/05/23 21:33:11 zeev Exp $ */
  
  #ifdef THREAD_SAFE
  #include "tls.h"
--- 29,35 ----
   */
  
  
! /* $Id: operators.c,v 1.89 1998/06/04 15:13:13 andi Exp $ */
  
  #ifdef THREAD_SAFE
  #include "tls.h"
***************
*** 703,714 ****
  
          if (op1->type == IS_STRING && op2->type == IS_STRING) {
                  result->value.str.len = op1->value.str.len + op2->value.str.len;
! result->value.str.val = (char *) emalloc(result->value.str.len + 1);
! memcpy(result->value.str.val, op1->value.str.val,op1->value.str.len);
                  memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val,op2->value.str.len);
                  result->value.str.val[result->value.str.len] = 0;
                  result->type = IS_STRING;
- STR_FREE(op1->value.str.val);
                  if (free_op2) {
                          STR_FREE(op2->value.str.val);
                  }
--- 703,718 ----
  
          if (op1->type == IS_STRING && op2->type == IS_STRING) {
                  result->value.str.len = op1->value.str.len + op2->value.str.len;
! if (op1->value.str.len == 0) { /* Takes care of empty_string etc. cases where we can't erealloc() */
! result->value.str.val = (char *) emalloc(result->value.str.len + 1);
! memcpy(result->value.str.val, op1->value.str.val,op1->value.str.len);
! STR_FREE(op1->value.str.val);
! } else {
! result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len + 1);
! }
                  memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val,op2->value.str.len);
                  result->value.str.val[result->value.str.len] = 0;
                  result->type = IS_STRING;
                  if (free_op2) {
                          STR_FREE(op2->value.str.val);
                  }