summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDavid Soria Parra <dsp@php.net>2009-05-27 11:58:44 +0000
committerDavid Soria Parra <dsp@php.net>2009-05-27 11:58:44 +0000
commitd482bb692a3398cff9e382e5e6b5ec0ee0c250f4 (patch)
tree24b92af9974f1a37c054c9c279c98424f4e81ab0 /Zend
parente6a7960d303de0123b3bb7c6fcb455ba0703e0f0 (diff)
downloadphp-git-d482bb692a3398cff9e382e5e6b5ec0ee0c250f4.tar.gz
Remove duplicated code of zend_hash_func and alias it to zend_get_hash_value
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_compile.c14
-rw-r--r--Zend/zend_hash.c12
-rw-r--r--Zend/zend_hash.h4
3 files changed, 9 insertions, 21 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 2ba2b6c50a..153fdfc308 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1459,7 +1459,7 @@ void zend_do_begin_lambda_function_declaration(znode *result, znode *function_to
current_op = &current_op_array->opcodes[current_op_number];
current_op->opcode = ZEND_DECLARE_LAMBDA_FUNCTION;
zval_dtor(&current_op->op2.u.constant);
- ZVAL_LONG(&current_op->op2.u.constant, zend_u_hash_func(Z_TYPE(current_op->op1.u.constant), Z_UNIVAL(current_op->op1.u.constant), Z_UNILEN(current_op->op1.u.constant)));
+ ZVAL_LONG(&current_op->op2.u.constant, zend_u_get_hash_value(Z_TYPE(current_op->op1.u.constant), Z_UNIVAL(current_op->op1.u.constant), Z_UNILEN(current_op->op1.u.constant)));
current_op->result = *result;
if (is_static) {
CG(active_op_array)->fn_flags |= ZEND_ACC_STATIC;
@@ -1695,7 +1695,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */
Z_TYPE(opline->op1.u.constant) = Z_TYPE(opline->op2.u.constant);
Z_UNIVAL(opline->op1.u.constant) = zend_u_str_case_fold(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), 0, &len);
Z_UNILEN(opline->op1.u.constant) = len;
- opline->extended_value = zend_u_hash_func(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant) + 1);
+ opline->extended_value = zend_u_get_hash_value(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant) + 1);
} else {
opline->extended_value = 0;
SET_UNUSED(opline->op1);
@@ -1741,7 +1741,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML
type = Z_TYPE(opline->op1.u.constant) = Z_TYPE(opline->op2.u.constant);
Z_UNIVAL(opline->op1.u.constant) = zend_u_str_case_fold(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), 0, &len);
Z_UNILEN(opline->op1.u.constant) = len;
- opline->extended_value = zend_u_hash_func(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant) + 1);
+ opline->extended_value = zend_u_get_hash_value(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant) + 1);
if(Z_TYPE(opline->op1.u.constant) == IS_UNICODE) {
slash.u = u_memrchr(Z_USTRVAL(opline->op1.u.constant), '\\', Z_USTRLEN(opline->op1.u.constant));
if(!slash.u) {
@@ -1765,7 +1765,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML
/* this is the length of namespace prefix */
Z_LVAL(opline2->op1.u.constant) = prefix_len;
/* this is the hash of the non-prefixed part, lowercased */
- opline2->extended_value = zend_u_hash_func(type, slash, name_len+1);
+ opline2->extended_value = zend_u_get_hash_value(type, slash, name_len+1);
SET_UNUSED(opline2->op2);
} else {
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
@@ -1775,7 +1775,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML
Z_TYPE(opline->op1.u.constant) = Z_TYPE(opline->op2.u.constant);
Z_UNIVAL(opline->op1.u.constant) = zend_u_str_case_fold(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), 0, &len);
Z_UNILEN(opline->op1.u.constant) = len;
- opline->extended_value = zend_u_hash_func(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant) + 1);
+ opline->extended_value = zend_u_get_hash_value(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant) + 1);
} else {
opline->extended_value = 0;
SET_UNUSED(opline->op1);
@@ -2100,7 +2100,7 @@ void zend_do_end_function_call(znode *function_name, znode *result, const znode
if (!is_method && !is_dynamic_fcall && function_name->op_type==IS_CONST) {
opline->opcode = ZEND_DO_FCALL;
opline->op1 = *function_name;
- ZVAL_LONG(&opline->op2.u.constant, zend_u_hash_func(Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant), Z_UNILEN(function_name->u.constant) + 1));
+ ZVAL_LONG(&opline->op2.u.constant, zend_u_get_hash_value(Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant), Z_UNILEN(function_name->u.constant) + 1));
} else {
opline->opcode = ZEND_DO_FCALL_BY_NAME;
SET_UNUSED(opline->op1);
@@ -4158,7 +4158,7 @@ void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC) /* {{{ */
opline->op1.op_type = IS_CONST;
opline->extended_value = 1;
SET_UNUSED(opline->op2);
- ZVAL_LONG(&opline->op2.u.constant, zend_u_hash_func(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant)+1));
+ ZVAL_LONG(&opline->op2.u.constant, zend_u_get_hash_value(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant)+1));
*result = opline->result;
}
/* }}} */
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 0060779c17..5e4429e4fe 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -120,18 +120,6 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin
static int zend_hash_do_resize(HashTable *ht);
-ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */
-{
- return zend_u_inline_hash_func(type, arKey, nKeyLength);
-}
-/* }}} */
-
-ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength) /* {{{ */
-{
- return zend_u_hash_func(IS_STRING, ZSTR(arKey), nKeyLength);
-}
-/* }}} */
-
#define UPDATE_DATA(ht, p, pData, nDataSize) \
if (nDataSize == sizeof(void*)) { \
if ((p)->pData != &(p)->pDataPtr) { \
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index bc3dd8227b..76aa2febd8 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -352,8 +352,8 @@ EMPTY_SWITCH_DEFAULT_CASE()
#define zend_u_inline_hash_func(type, arKey, nKeyLength) \
zend_inline_hash_func(arKey.s, USTR_BYTES(type, nKeyLength))
-ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength);
-ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength);
+#define zend_hash_func(arKey, nKeyLength) zend_get_hash_value(arKey, nKeyLength)
+#define zend_u_hash_func(type, arKey, nKeyLength) zend_u_get_hash_value(type, arKey, nKeyLength)
#if ZEND_DEBUG
/* debug */