cvs: ZendEngine2 / zend_builtin_functions.c php-src unicode-progress.txt
| From: | Dmitry Stogov | Date: | Tue, 23 Aug 2005 06:51:11 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c php-src unicode-progress.txt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4063@lists.php.net to get a copy of this message | ||
dmitry Tue Aug 23 02:51:11 2005 EDT
Modified files:
/php-src unicode-progress.txt
/ZendEngine2 zend_builtin_functions.c
Log:
Unicode support for strncasecmp()
http://cvs.php.net/diff.php/php-src/unicode-progress.txt?r1=1.4&r2=1.5&ty=u
Index: php-src/unicode-progress.txt
diff -u php-src/unicode-progress.txt:1.4 php-src/unicode-progress.txt:1.5
--- php-src/unicode-progress.txt:1.4 Mon Aug 22 08:22:04 2005
+++ php-src/unicode-progress.txt Tue Aug 23 02:51:11 2005
@@ -25,8 +25,6 @@
extension_loaded()
get_extension_funcs()
get_included_files()
- strcasecmp()
- strncasecmp()
Completed:
class_exists()
create_function()
@@ -60,8 +58,10 @@
restore_exception_handler()
set_error_handler()
set_exception_handler()
+ strcasecmp()
strcmp()
strlen()
+ strncasecmp()
strncmp()
trigger_error()
zend_thread_id()
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.287&r2=1.288&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.287 ZendEngine2/zend_builtin_functions.c:1.288
--- ZendEngine2/zend_builtin_functions.c:1.287 Mon Aug 22 18:17:19 2005
+++ ZendEngine2/zend_builtin_functions.c Tue Aug 23 02:51:11 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.287 2005/08/22 22:17:19 andrei Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.288 2005/08/23 06:51:11 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -368,15 +368,20 @@
Binary safe string comparison */
ZEND_FUNCTION(strncasecmp)
{
- zval **s1, **s2, **s3;
+ void *s1, *s2;
+ int s1_len, s2_len;
+ zend_uchar s1_type, s2_type;
+ long len;
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TTl", &s1, &s1_len,
+ &s1_type, &s2, &s2_len, &s2_type, &len) == FAILURE) {
+ return;
+ }
+ if (s1_type == IS_UNICODE) {
+ RETURN_LONG(zend_u_binary_strcasecmp(s1, MIN(s1_len, len), s2, MIN(s2_len, len)));
+ } else {
+ RETURN_LONG(zend_binary_strcasecmp(s1, MIN(s1_len, len), s2, MIN(s2_len, len)));
}
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- convert_to_long_ex(s3);
- RETURN_LONG(zend_binary_zval_strncasecmp(*s1, *s2, *s3));
}
/* }}} */