Hello Andrei,

  for the return_value this *might* result in the same behavior. The
REPLACE_ZVAL_VALUE() macro checks refount and is_ref first which is
what i wanted to avoid. The changes i did ensure the both are neither
read nor changed.

regards
marcus

Friday, March 11, 2005, 9:40:16 PM, you wrote:

> Why not use REPLACE_ZVAL_VALUE() macro?

> On Thu, 10 Mar 2005, Marcus Boerger wrote:
>> helly         Thu Mar 10 18:42:16 2005 EDT
>> 
>>   Modified files:              
>>     /php-src/ext/standard     string.c 
>>   Log:
>>   - Do not touch return_valu's refcount or is_ref
>>   
>> http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.429&r2=1.430&ty=u
>> Index: php-src/ext/standard/string.c
>> diff -u php-src/ext/standard/string.c:1.429
>> php-src/ext/standard/string.c:1.430
>> --- php-src/ext/standard/string.c:1.429       Tue Mar  1 09:59:37 2005
>> +++ php-src/ext/standard/string.c     Thu Mar 10 18:42:15 2005
>> @@ -18,7 +18,7 @@
>>    
>> +----------------------------------------------------------------------+
>>   */
>>  
>> -/* $Id: string.c,v 1.429 2005/03/01 14:59:37 hyanantha Exp $ */
>> +/* $Id: string.c,v 1.430 2005/03/10 23:42:15 helly Exp $ */
>>  
>>  /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
>>  
>> @@ -1078,8 +1078,7 @@
>>       }
>>       convert_to_string_ex(arg);
>>  
>> -     *return_value = **arg;
>> -     zval_copy_ctor(return_value);
>> +     RETVAL_ZVAL(*arg, 1, 0);
>>       php_strtoupper(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
>>  }
>>  /* }}} */
>> @@ -1113,8 +1112,7 @@
>>       }
>>       convert_to_string_ex(str);
>>  
>> -     *return_value = **str;
>> -     zval_copy_ctor(return_value);
>> +     RETVAL_ZVAL(*str, 1, 0);
>>       ret = php_strtolower(Z_STRVAL_P(return_value), 
>> Z_STRLEN_P(return_value));
>>  }
>>  /* }}} */
>> @@ -1345,19 +1343,17 @@
>>       }
>>  
>>       if (opt == PHP_PATHINFO_ALL) {
>> -             *return_value = *tmp;
>> +             RETVAL_ZVAL(tmp, 1, 0);
>>       } else {
>>               zval **element;
>>               if (zend_hash_get_current_data(Z_ARRVAL_P(tmp), (void **) 
>> &element) == SUCCESS) {
>> -                     *return_value = **element;
>> +                     RETVAL_ZVAL(*element, 1, 0);
>>               } else {
>>                       ZVAL_EMPTY_STRING(return_value);
>>               }
>>       }
>>  
>> -     zval_copy_ctor(return_value);
>> -     zval_dtor(tmp);
>> -     efree(tmp);
>> +     zval_ptr_dtor(&tmp);
>>  }
>>  /* }}} */
>>  
>> @@ -4490,8 +4486,7 @@
>>       /* If resulting string turns out to be shorter than input string,
>>          we simply copy the input and return. */
>>       if (num_pad_chars < 0) {
>> -             *return_value = **input;
>> -             zval_copy_ctor(return_value);
>> +             RETVAL_ZVAL(*input, 1, 0);
>>               return;
>>       }
>>  
>> @@ -4598,9 +4593,7 @@
>>       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
>>               WRONG_PARAM_COUNT;
>>       }
>> -     convert_to_string_ex(arg);
>> -     *return_value = **arg;
>> -     zval_copy_ctor(return_value);
>> +     RETVAL_ZVAL(*arg, 1, 0);
>>  
>>       php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), 
>> rot13_from, rot13_to, 52);
>>  }
>> @@ -4644,8 +4637,7 @@
>>       }
>>       
>>       convert_to_string_ex(arg);
>> -     *return_value = **arg;
>> -     zval_copy_ctor(return_value);
>> +     RETVAL_ZVAL(*arg, 1, 0);
>>       if (Z_STRLEN_P(return_value) > 1) { 
>>               php_string_shuffle(Z_STRVAL_P(return_value), (long)
>> Z_STRLEN_P(return_value) TSRMLS_CC);
>>       }
>> 
>> -- 
>> PHP CVS Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php



> - Andrei




-- 
Best regards,
 Marcus                            mailto:[EMAIL PROTECTED]

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to