cvs: pecl /inclued inclued_zend.c
| From: | Antony Dovgal | Date: | Wed, 23 Jan 2008 22:58:08 +0000 |
| Subject: | cvs: pecl /inclued inclued_zend.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-9588@lists.php.net to get a copy of this message | ||
tony2001 Wed Jan 23 22:58:08 2008 UTC
Modified files:
/pecl/inclued inclued_zend.c
Log:
fix folding, nuke unused vars and optimize add_assoc_*() calls a bit
http://cvs.php.net/viewvc.cgi/pecl/inclued/inclued_zend.c?r1=1.1&r2=1.2&diff_format=u
Index: pecl/inclued/inclued_zend.c
diff -u pecl/inclued/inclued_zend.c:1.1 pecl/inclued/inclued_zend.c:1.2
--- pecl/inclued/inclued_zend.c:1.1 Wed Jan 23 20:05:28 2008
+++ pecl/inclued/inclued_zend.c Wed Jan 23 22:58:08 2008
@@ -16,14 +16,14 @@
+----------------------------------------------------------------------+
*/
-/* $Id: inclued_zend.c,v 1.1 2008/01/23 20:05:28 gopalv Exp $ */
+/* $Id: inclued_zend.c,v 1.2 2008/01/23 22:58:08 tony2001 Exp $ */
#include "inclued.h"
#include "inclued_zend.h"
#define INCLUED_EX_T(offset) (*(temp_variable *)((char*)execute_data->Ts + offset))
-static zval *inclued_get_zval_ptr(znode *node, zval **freeval, zend_execute_data *execute_data
TSRMLS_DC)
+static zval *inclued_get_zval_ptr(znode *node, zval **freeval, zend_execute_data *execute_data
TSRMLS_DC) /* {{{ */
{
*freeval = NULL;
@@ -55,8 +55,9 @@
return NULL;
}
}
+/* }}} */
-static int add_include(ZEND_OPCODE_HANDLER_ARGS)
+static void add_include(ZEND_OPCODE_HANDLER_ARGS) /* {{{ */
{
zend_op *opline = execute_data->opline;
zval * includes_hash = INCLUED_G(includes_hash);
@@ -108,14 +109,14 @@
MAKE_STD_ZVAL(include_entry);
array_init(include_entry);
- add_assoc_string(include_entry, "operation", operation, 1);
- add_assoc_long(include_entry, "op_type", op_type);
- add_assoc_string(include_entry, "fromfile", execute_data->op_array->filename, 1);
- add_assoc_long(include_entry, "fromline", opline->lineno);
+ add_assoc_string_ex(include_entry, "operation", sizeof("operation"),
operation, 1);
+ add_assoc_long_ex(include_entry, "op_type", sizeof("op_type"), op_type);
+ add_assoc_string_ex(include_entry, "fromfile", sizeof("fromfile"),
execute_data->op_array->filename, 1);
+ add_assoc_long_ex(include_entry, "fromline", sizeof("fromline"),
opline->lineno);
if(execute_data->op_array->function_name)
{
- add_assoc_string(include_entry, "function",
(char*)execute_data->op_array->function_name, 1);
+ add_assoc_string_ex(include_entry, "function", sizeof("function"),
(char*)execute_data->op_array->function_name, 1);
}
add_next_index_zval(includes_hash, include_entry);
@@ -129,6 +130,7 @@
{
tmp_inc_filename = *inc_filename;
zval_copy_ctor(&tmp_inc_filename);
+ INIT_PZVAL(&tmp_inc_filename);
convert_to_string(&tmp_inc_filename);
inc_filename = &tmp_inc_filename;
}
@@ -157,32 +159,32 @@
array_init(include_entry);
- add_assoc_string(include_entry, "operation", operation, 1);
- add_assoc_long(include_entry, "op_type", op_type);
- add_assoc_string(include_entry, "filename", Z_STRVAL_P(inc_filename), 1);
- add_assoc_string(include_entry, "opened_path", file_handle.opened_path, 1);
+ add_assoc_string_ex(include_entry, "operation", sizeof("operation"),
operation, 1);
+ add_assoc_long_ex(include_entry, "op_type", sizeof("op_type"), op_type);
+ add_assoc_string_ex(include_entry, "filename", sizeof("filename"),
Z_STRVAL_P(inc_filename), 1);
+ add_assoc_string_ex(include_entry, "opened_path", sizeof("opened_path"),
file_handle.opened_path, 1);
if(zend_hash_exists(&EG(included_files), file_handle.opened_path,
strlen(file_handle.opened_path)+1))
{
- add_assoc_bool(include_entry, "duplicate", 1);
+ add_assoc_bool_ex(include_entry, "duplicate", sizeof("duplicate"), 1);
}
- add_assoc_string(include_entry, "fromfile", execute_data->op_array->filename, 1);
- add_assoc_long(include_entry, "fromline", opline->lineno);
+ add_assoc_string_ex(include_entry, "fromfile", sizeof("fromfile"),
execute_data->op_array->filename, 1);
+ add_assoc_long_ex(include_entry, "fromline", sizeof("fromline"),
opline->lineno);
if(execute_data->op_array->function_name)
{
- add_assoc_string(include_entry, "function",
(char*)execute_data->op_array->function_name, 1);
+ add_assoc_string_ex(include_entry, "function", sizeof("function"),
(char*)execute_data->op_array->function_name, 1);
}
if(opline->op1.op_type != IS_CONST)
{
- add_assoc_bool(include_entry, "variable_include", 1);
+ add_assoc_bool_ex(include_entry, "variable_include",
sizeof("variable_include"), 1);
}
if(wrapper != &php_plain_files_wrapper)
{
- add_assoc_string(include_entry, "streamwrapper", (char*)wrapper->wops->label,
1);
+ add_assoc_string_ex(include_entry, "streamwrapper", sizeof("streamwrapper"),
(char*)wrapper->wops->label, 1);
}
add_next_index_zval(includes_hash, include_entry);
@@ -195,13 +197,15 @@
zval_dtor(&tmp_inc_filename);
}
}
+/* }}} */
-static int inclued_op_ZEND_INCLUDE_OR_EVAL(ZEND_OPCODE_HANDLER_ARGS)
+static int inclued_op_ZEND_INCLUDE_OR_EVAL(ZEND_OPCODE_HANDLER_ARGS) /* {{{ */
{
add_include(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
return ZEND_USER_OPCODE_DISPATCH;
}
+/* }}} */
#define INCLUED_ZCE(entry, ce) do { \
MAKE_STD_ZVAL(entry); \
@@ -215,7 +219,7 @@
} \
}while(0)
-static void add_class(ZEND_OPCODE_HANDLER_ARGS)
+static void add_class(ZEND_OPCODE_HANDLER_ARGS) /* {{{ */
{
zend_op *opline = execute_data->opline;
zval *inh_hash = INCLUED_G(inh_hash);
@@ -223,8 +227,6 @@
zend_uchar opcode = opline->opcode;
zend_class_entry* parent_ce = NULL;
- char *operation = NULL;
-
assert(inh_hash != NULL);
MAKE_STD_ZVAL(class_entry);
@@ -256,17 +258,19 @@
add_next_index_zval(inh_hash, class_entry);
}
+/* }}} */
-static int inclued_op_ZEND_DECLARE_CLASS(ZEND_OPCODE_HANDLER_ARGS)
+static int inclued_op_ZEND_DECLARE_CLASS(ZEND_OPCODE_HANDLER_ARGS) /* {{{ */
{
add_class(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
return ZEND_USER_OPCODE_DISPATCH;
}
+/* }}} */
#define inclued_op_ZEND_DECLARE_INHERITED_CLASS inclued_op_ZEND_DECLARE_CLASS
-static void add_interface(ZEND_OPCODE_HANDLER_ARGS)
+static void add_interface(ZEND_OPCODE_HANDLER_ARGS) /* {{{ */
{
zend_op *opline = execute_data->opline;
zval *inh_hash = INCLUED_G(inh_hash);
@@ -295,15 +299,17 @@
add_next_index_zval(inh_hash, iface_entry);
}
+/* }}} */
-static int inclued_op_ZEND_ADD_INTERFACE(ZEND_OPCODE_HANDLER_ARGS)
+static int inclued_op_ZEND_ADD_INTERFACE(ZEND_OPCODE_HANDLER_ARGS) /* {{{ */
{
add_interface(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
return ZEND_USER_OPCODE_DISPATCH;
}
+/* }}} */
-void inclued_zend_init(TSRMLS_D)
+void inclued_zend_init(TSRMLS_D) /* {{{ */
{
if(INCLUED_G(enabled))
{
@@ -328,8 +334,19 @@
}
}
}
+/* }}} */
-void inclued_zend_shutdown(TSRMLS_D)
+void inclued_zend_shutdown(TSRMLS_D) /* {{{ */
{
/* nothing */
}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */