cvs: ZendEngine2 / zend_operators.c

From: Date: Wed, 02 Aug 2006 20:31:40 +0000
Subject: cvs: ZendEngine2 / zend_operators.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5144@lists.php.net to get a copy of this message
andrei Wed Aug 2 20:31:40 2006 UTC Modified files: /ZendEngine2 zend_operators.c Log: Make string comparison functions conver to unicode or printable strings depending on unicode.semantics and do the right thing. http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.253&r2=1.254&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.253 ZendEngine2/zend_operators.c:1.254 --- ZendEngine2/zend_operators.c:1.253 Tue Aug 1 17:47:24 2006 +++ ZendEngine2/zend_operators.c Wed Aug 2 20:31:40 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.253 2006/08/01 17:47:24 andrei Exp $ */ +/* $Id: zend_operators.c,v 1.254 2006/08/02 20:31:40 andrei Exp $ */ #include <ctype.h> @@ -1648,8 +1648,13 @@ zval op1_copy, op2_copy; int use_copy1, use_copy2; - zend_make_printable_zval(op1, &op1_copy, &use_copy1); - zend_make_printable_zval(op2, &op2_copy, &use_copy2); + if (UG(unicode)) { + zend_make_unicode_zval(op1, &op1_copy, &use_copy1); + zend_make_unicode_zval(op2, &op2_copy, &use_copy2); + } else { + zend_make_printable_zval(op1, &op1_copy, &use_copy1); + zend_make_printable_zval(op2, &op2_copy, &use_copy2); + } if (use_copy1) { op1 = &op1_copy; @@ -1658,7 +1663,11 @@ op2 = &op2_copy; } - Z_LVAL_P(result) = zend_binary_zval_strcmp(op1, op2); + if (UG(unicode)) { + Z_LVAL_P(result) = zend_u_binary_zval_strcmp(op1, op2); + } else { + Z_LVAL_P(result) = zend_binary_zval_strcmp(op1, op2); + } Z_TYPE_P(result) = IS_LONG; if (use_copy1) { @@ -1675,8 +1684,13 @@ zval op1_copy, op2_copy; int use_copy1, use_copy2; - zend_make_unicode_zval(op1, &op1_copy, &use_copy1); - zend_make_unicode_zval(op2, &op2_copy, &use_copy2); + if (UG(unicode)) { + zend_make_unicode_zval(op1, &op1_copy, &use_copy1); + zend_make_unicode_zval(op2, &op2_copy, &use_copy2); + } else { + zend_make_printable_zval(op1, &op1_copy, &use_copy1); + zend_make_printable_zval(op2, &op2_copy, &use_copy2); + } if (use_copy1) { op1 = &op1_copy; @@ -1685,7 +1699,11 @@ op2 = &op2_copy; } - Z_LVAL_P(result) = ucol_strcoll(UG(default_collator)->coll, Z_USTRVAL_P(op1), Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); + if (UG(unicode)) { + Z_LVAL_P(result) = ucol_strcoll(UG(default_collator)->coll, Z_USTRVAL_P(op1), Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); + } else { + Z_LVAL_P(result) = strcoll(Z_STRVAL_P(op1), Z_STRVAL_P(op2)); + } Z_TYPE_P(result) = IS_LONG; if (use_copy1) {

« previous php.zend-engine.cvs (#5144) next »