cvs: ZendEngine2 / zend.h zend_compile.c

From: Date: Mon, 16 Oct 2006 21:13:13 +0000
Subject: cvs: ZendEngine2 / zend.h zend_compile.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5329@lists.php.net to get a copy of this message
andrei Mon Oct 16 21:13:13 2006 UTC Modified files: /ZendEngine2 zend.h zend_compile.c Log: Optimize ZEND_U_CASE_EQUAL() and move it to the header file. http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.h?r1=1.328&r2=1.329&diff_format=u Index: ZendEngine2/zend.h diff -u ZendEngine2/zend.h:1.328 ZendEngine2/zend.h:1.329 --- ZendEngine2/zend.h:1.328 Tue Oct 3 16:28:02 2006 +++ ZendEngine2/zend.h Mon Oct 16 21:13:13 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.h,v 1.328 2006/10/03 16:28:02 pollita Exp $ */ +/* $Id: zend.h,v 1.329 2006/10/16 21:13:13 andrei Exp $ */ #ifndef ZEND_H #define ZEND_H @@ -707,6 +707,22 @@ (!memcmp((ustr).s,(str),(slen))): \ (!zend_cmp_unicode_and_literal((ustr).u, ulen, str, slen))) +static inline int ZEND_U_CASE_EQUAL(zend_uchar type, zstr ustr, int ulen, char *str, int slen) +{ + zstr lcname; + int ret; + + if (type == IS_UNICODE) { + lcname.u = zend_ascii_to_unicode(str, slen+1 ZEND_FILE_LINE_CC); + ret = !u_memcasecmp(lcname.u, ustr.u, slen, 0); + } else { + lcname.s = zend_str_tolower_dup(ustr.s, ulen); + ret = !memcmp(lcname.s, str, slen); + } + efree(lcname.v); + return ret; +} + #endif /* ZEND_H */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.725&r2=1.726&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.725 ZendEngine2/zend_compile.c:1.726 --- ZendEngine2/zend_compile.c:1.725 Tue Oct 3 11:10:54 2006 +++ ZendEngine2/zend_compile.c Mon Oct 16 21:13:13 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.725 2006/10/03 11:10:54 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.726 2006/10/16 21:13:13 andrei Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1324,19 +1324,6 @@ } -static inline int ZEND_U_CASE_EQUAL(zend_uchar type, zstr ustr, int ulen, char *str, int slen) -{ - zstr lcname; - unsigned int lcname_len; - int ret; - - lcname = zend_u_str_case_fold(type, ustr, ulen, 0, &lcname_len); - ret = ZEND_U_EQUAL(type, lcname, lcname_len, str, slen); - efree(lcname.v); - return ret; -} - - void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, znode *varname, zend_uchar pass_by_reference TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);

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