Just call strcmp() rather than strlen() twice plus zend_binary_strcmp()

This commit is contained in:
Olly Betts 2014-02-17 16:25:29 +13:00
commit 7af8b13ef7

View file

@ -164,7 +164,7 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
convert_to_string_ex(z_var); convert_to_string_ex(z_var);
s1 = Z_STRVAL_PP(z_var); s1 = Z_STRVAL_PP(z_var);
if ((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) { if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if (s1) if (s1)
$1 = estrdup(s1); $1 = estrdup(s1);
else else
@ -190,9 +190,9 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var); s1 = Z_STRVAL_PP(z_var);
if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) { if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if(s1) if (s1)
strncpy($1, s1, $1_dim0); strncpy($1, s1, $1_dim0);
} }
} }
@ -288,7 +288,7 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var); s1 = Z_STRVAL_PP(z_var);
if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1) )) { if((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if(s1) if(s1)
efree(s1); efree(s1);
if($1) { if($1) {
@ -325,7 +325,7 @@
deliberate error cos this code looks bogus to me deliberate error cos this code looks bogus to me
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var); s1 = Z_STRVAL_PP(z_var);
if((s1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) { if((s1 == NULL) || strcmp(s1, $1)) {
if($1) { if($1) {
(*z_var)->value.str.val = estrdup($1); (*z_var)->value.str.val = estrdup($1);
(*z_var)->value.str.len = strlen($1)+1; (*z_var)->value.str.len = strlen($1)+1;