Permalink
Browse files

Eliminate TSRMLS_FETCH() calls in destroy_op_array() and zend_get_cla…

…ss_entry().
  • Loading branch information...
1 parent 866332a commit 3fc852824fb2ff8a9d090594bdf33d1d086d9af4 @sebastianbergmann sebastianbergmann committed Mar 26, 2003
View
@@ -1028,7 +1028,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
zval_ptr_dtor(EG(return_value_ptr_ptr));
local_retval = NULL;
}
- destroy_op_array(EG(active_op_array));
+ destroy_op_array(EG(active_op_array) TSRMLS_CC);
efree(EG(active_op_array));
} else if (type==ZEND_REQUIRE) {
va_end(files);
View
@@ -199,18 +199,17 @@ ZEND_API char *zend_zval_type_name(zval *arg)
}
}
-ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject)
+ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC)
{
if (Z_OBJ_HT_P(zobject)->get_class_entry) {
- TSRMLS_FETCH();
return Z_OBJ_HT_P(zobject)->get_class_entry(zobject TSRMLS_CC);
} else {
zend_error(E_ERROR, "Class entry requested for an object without PHP class");
return NULL;
}
}
-static int zend_check_class(zval *obj, zend_class_entry *expected_ce)
+static int zend_check_class(zval *obj, zend_class_entry *expected_ce TSRMLS_DC)
{
zend_class_entry *ce;
@@ -227,7 +226,7 @@ static int zend_check_class(zval *obj, zend_class_entry *expected_ce)
return 0;
}
-static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec)
+static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
{
char *spec_walk = *spec;
char c = *spec_walk++;
@@ -410,7 +409,7 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec)
{
zval **p = va_arg(*va, zval **);
zend_class_entry *ce = va_arg(*va, zend_class_entry *);
- if (!zend_check_class(*arg, ce)) {
+ if (!zend_check_class(*arg, ce TSRMLS_CC)) {
if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
*p = NULL;
} else {
@@ -445,7 +444,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
{
char *expected_type = NULL;
- expected_type = zend_parse_arg_impl(arg, va, spec);
+ expected_type = zend_parse_arg_impl(arg, va, spec TSRMLS_CC);
if (expected_type) {
if (!quiet) {
zend_error(E_WARNING, "%s() expects parameter %d to be %s, %s given",
@@ -610,7 +609,7 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC,
return FAILURE;
} else {
- if (!zend_check_class(*parameter, ce)) {
+ if (!zend_check_class(*parameter, ce TSRMLS_CC)) {
if (!quiet) {
zend_error(E_WARNING, "%s() expects parameter 1 to be %s, %s given",
get_active_function_name(TSRMLS_C), ce->name,
View
@@ -142,7 +142,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
ZEND_API char *zend_get_module_version(char *module_name);
-ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject);
+ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
#define getThis() (this_ptr)
@@ -530,7 +530,7 @@ ZEND_FUNCTION(get_class)
Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_len, 0 TSRMLS_CC) != SUCCESS) {
zend_class_entry *ce;
- ce = zend_get_class_entry(*arg);
+ ce = zend_get_class_entry(*arg TSRMLS_CC);
if (!ce) {
RETURN_FALSE;
}
@@ -562,7 +562,7 @@ ZEND_FUNCTION(get_parent_class)
if (Z_OBJ_HT_PP(arg)->get_class_name
&& Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) {
RETURN_STRINGL(name, name_length, 1);
- } else if (Z_OBJ_HT_PP(arg)->get_class_entry && (ce = zend_get_class_entry(*arg))) {
+ } else if (Z_OBJ_HT_PP(arg)->get_class_entry && (ce = zend_get_class_entry(*arg TSRMLS_CC))) {
RETURN_STRINGL(ce->name, ce->name_length, 1);
} else {
RETURN_FALSE;
View
@@ -433,13 +433,13 @@ ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...);
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC);
-ZEND_API void destroy_op_array(zend_op_array *op_array);
+ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC);
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC);
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
-ZEND_API void destroy_zend_function(zend_function *function);
+ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
ZEND_API void destroy_zend_class(zend_class_entry **pce);
void zend_class_add_ref(zend_class_entry **ce);
View
@@ -3456,7 +3456,7 @@ int zend_include_or_eval_handler(ZEND_OPCODE_HANDLER_ARGS)
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = op_array;
EG(function_state_ptr) = &EX(function_state);
- destroy_op_array(new_op_array);
+ destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
} else {
if (return_value_used) {
@@ -820,7 +820,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR
EG(opline_ptr) = original_opline_ptr;
EG(active_op_array) = original_active_op_array;
EG(function_state_ptr) = original_function_state_ptr;
- destroy_op_array(new_op_array);
+ destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
retval = SUCCESS;
View
@@ -97,11 +97,11 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
}
-ZEND_API void destroy_zend_function(zend_function *function)
+ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
{
switch (function->type) {
case ZEND_USER_FUNCTION:
- destroy_op_array((zend_op_array *) function);
+ destroy_op_array((zend_op_array *) function TSRMLS_CC);
break;
case ZEND_INTERNAL_FUNCTION:
/* do nothing */
@@ -194,11 +194,10 @@ void zend_class_add_ref(zend_class_entry **ce)
}
-ZEND_API void destroy_op_array(zend_op_array *op_array)
+ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
{
zend_op *opline = op_array->opcodes;
zend_op *end = op_array->opcodes+op_array->last;
- TSRMLS_FETCH();
if (op_array->static_variables) {
zend_hash_destroy(op_array->static_variables);
@@ -239,7 +239,7 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
#define Z_ARRVAL(zval) (zval).value.ht
#define Z_OBJ_HANDLE(zval) (zval).value.obj.handle
#define Z_OBJ_HT(zval) (zval).value.obj.handlers
-#define Z_OBJCE(zval) zend_get_class_entry(&(zval))
+#define Z_OBJCE(zval) zend_get_class_entry(&(zval) TSRMLS_CC)
#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
#define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
#define Z_RESVAL(zval) (zval).value.lval
View
@@ -676,6 +676,7 @@ static int com_call(rpc_string method_name, void *data, zval *return_value, int
VARIANT result;
int current_arg, current_variant;
char *ErrString = NULL;
+ TSRMLS_FETCH();
/* if the length of the name is 0, we are dealing with a pointer to a dispid */
assert(method_name.len == 0);
@@ -684,7 +685,7 @@ static int com_call(rpc_string method_name, void *data, zval *return_value, int
for (current_arg = 0; current_arg < num_args; current_arg++) {
current_variant = num_args - current_arg - 1;
- php_zval_to_variant(*args[current_arg], &variant_args[current_variant], C_CODEPAGE((comval *) data));
+ php_zval_to_variant(*args[current_arg], &variant_args[current_variant], C_CODEPAGE((comval *) data) TSRMLS_CC);
}
dispparams.rgvarg = variant_args;
@@ -777,11 +778,12 @@ static int com_set(rpc_string property_name, zval *value, void *data)
DISPPARAMS dispparams;
VARIANT *var;
char *error_message, *ErrString = NULL;
+ TSRMLS_FETCH();
var = (VARIANT *) emalloc(sizeof(VARIANT));
VariantInit(var);
- php_zval_to_variant(value, var, C_CODEPAGE((comval *) data));
+ php_zval_to_variant(value, var, C_CODEPAGE((comval *) data) TSRMLS_CC);
dispparams.rgvarg = var;
dispparams.rgdispidNamedArgs = &mydispid;
dispparams.cArgs = 1;
@@ -897,7 +899,7 @@ static ZEND_FUNCTION(com_indexed_prop_set)
for (current_arg = 2; current_arg < arg_count; current_arg++) {
current_variant = arg_count - current_arg - 1;
php_zval_to_variant(arguments[current_arg], &variant_args[current_variant],
- C_CODEPAGE((comval *)intern->data));
+ C_CODEPAGE((comval *)intern->data) TSRMLS_CC);
}
dispparams.rgvarg = variant_args;
@@ -48,7 +48,7 @@
static int comval_to_variant(zval *zval_arg, VARIANT *var_arg);
/* implementations */
-PHPAPI void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage)
+PHPAPI void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage TSRMLS_DC)
{
int type = VT_EMPTY; /* default variant type */
@@ -92,11 +92,11 @@ PHPAPI void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage)
break;
}
- php_zval_to_variant_ex(zval_arg, var_arg, type, codepage);
+ php_zval_to_variant_ex(zval_arg, var_arg, type, codepage TSRMLS_CC);
}
-PHPAPI void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage)
+PHPAPI void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC)
{
OLECHAR *unicode_str = NULL;
@@ -140,9 +140,9 @@ PHPAPI void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, i
/* Add another value to the safe array */
if (SUCCEEDED(SafeArrayPtrOfIndex( safeArray, &i, &v))) { /* Pointer to output element entry retrieved successfully */
if (type) { /* explicit type */
- php_zval_to_variant_ex(*entry, v, type, codepage); /* Do the required conversion */
+ php_zval_to_variant_ex(*entry, v, type, codepage TSRMLS_CC); /* Do the required conversion */
} else {
- php_zval_to_variant(*entry, v, codepage); /* Do the required conversion */
+ php_zval_to_variant(*entry, v, codepage TSRMLS_CC); /* Do the required conversion */
}
} else {
rpc_error(E_WARNING, "phpArrayToSafeArray() - Unable to retrieve pointer to output element number (%d)", i);
@@ -30,8 +30,8 @@
BEGIN_EXTERN_C()
-ZEND_API void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage);
-ZEND_API void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage);
+ZEND_API void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);
+ZEND_API void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC);
ZEND_API int php_variant_to_zval(VARIANT *var_arg, zval *zval_arg, int codepage);
ZEND_API OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage, int persist);
@@ -103,6 +103,7 @@ static HRESULT STDMETHODCALLTYPE disp_queryinterface(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
+ TSRMLS_FETCH();
FETCH_DISP("QueryInterface");
if (IsEqualGUID(&IID_IUnknown, riid) ||
@@ -120,6 +121,7 @@ static HRESULT STDMETHODCALLTYPE disp_queryinterface(
static ULONG STDMETHODCALLTYPE disp_addref(IDispatchEx *This)
{
+ TSRMLS_FETCH();
FETCH_DISP("AddRef");
return InterlockedIncrement(&disp->refcount);
@@ -145,6 +147,7 @@ static HRESULT STDMETHODCALLTYPE disp_gettypeinfocount(
IDispatchEx *This,
/* [out] */ UINT *pctinfo)
{
+ TSRMLS_FETCH();
FETCH_DISP("GetTypeInfoCount");
*pctinfo = 0;
@@ -157,6 +160,7 @@ static HRESULT STDMETHODCALLTYPE disp_gettypeinfo(
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo)
{
+ TSRMLS_FETCH();
FETCH_DISP("GetTypeInfo");
*ppTInfo = NULL;
@@ -328,7 +332,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
V_VT(pvarRes) = VT_DISPATCH;
V_DISPATCH(pvarRes) = php_COM_export_object(retval);
} else {
- php_zval_to_variant(retval, pvarRes, codepage);
+ php_zval_to_variant(retval, pvarRes, codepage TSRMLS_CC);
}
}
zval_ptr_dtor(&retval);
@@ -348,6 +352,7 @@ static HRESULT STDMETHODCALLTYPE disp_deletememberbyname(
/* [in] */ BSTR bstrName,
/* [in] */ DWORD grfdex)
{
+ TSRMLS_FETCH();
FETCH_DISP("DeleteMemberByName");
return S_FALSE;
@@ -357,6 +362,7 @@ static HRESULT STDMETHODCALLTYPE disp_deletememberbydispid(
IDispatchEx *This,
/* [in] */ DISPID id)
{
+ TSRMLS_FETCH();
FETCH_DISP("DeleteMemberByDispID");
return S_FALSE;
@@ -368,6 +374,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmemberproperties(
/* [in] */ DWORD grfdexFetch,
/* [out] */ DWORD *pgrfdex)
{
+ TSRMLS_FETCH();
FETCH_DISP("GetMemberProperties");
return DISP_E_UNKNOWNNAME;
@@ -399,6 +406,7 @@ static HRESULT STDMETHODCALLTYPE disp_getnextdispid(
/* [out] */ DISPID *pid)
{
ulong next = id+1;
+ TSRMLS_FETCH();
FETCH_DISP("GetNextDispID");
while(!zend_hash_index_exists(disp->dispid_to_name, next))
@@ -415,6 +423,7 @@ static HRESULT STDMETHODCALLTYPE disp_getnamespaceparent(
IDispatchEx *This,
/* [out] */ IUnknown **ppunk)
{
+ TSRMLS_FETCH();
FETCH_DISP("GetNameSpaceParent");
*ppunk = NULL;
@@ -280,9 +280,9 @@ static void variant_write(zval *object, zval *member, zval *value TSRMLS_DC)
}
if (!strcmp(Z_STRVAL_P(member), "value")) {
- php_zval_to_variant(value, var->var, var->codepage);
+ php_zval_to_variant(value, var->var, var->codepage TSRMLS_CC);
} else if (zend_hash_find(&types, Z_STRVAL_P(member), Z_STRLEN_P(member) + 1, (void **) &type) == SUCCESS) {
- php_zval_to_variant_ex(value, var->var, *type, var->codepage);
+ php_zval_to_variant_ex(value, var->var, *type, var->codepage TSRMLS_CC);
} else {
rpc_error(E_WARNING, "Unknown member.");
}
@@ -314,9 +314,9 @@ ZEND_FUNCTION(variant_load)
if (value) {
if (type) {
- php_zval_to_variant_ex(value, var->var, type, var->codepage);
+ php_zval_to_variant_ex(value, var->var, type, var->codepage TSRMLS_CC);
} else {
- php_zval_to_variant(value, var->var, var->codepage);
+ php_zval_to_variant(value, var->var, var->codepage TSRMLS_CC);
}
}
}
View
@@ -1697,7 +1697,7 @@ PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC)
zend_destroy_file_handle(file TSRMLS_CC);
if (op_array) {
- destroy_op_array(op_array);
+ destroy_op_array(op_array TSRMLS_CC);
efree(op_array);
return SUCCESS;
} else {

0 comments on commit 3fc8528

Please sign in to comment.