Skip to content

Commit caf0a53

Browse files
authored
ext/tidy: simplify tidy_instantiate (#18647)
1 parent ab80e09 commit caf0a53

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

ext/tidy/tidy.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ static zend_string *php_tidy_file_to_mem(const char *, bool);
124124
static void tidy_object_free_storage(zend_object *);
125125
static zend_object *tidy_object_new_node(zend_class_entry *);
126126
static zend_object *tidy_object_new_doc(zend_class_entry *);
127-
static zval *tidy_instantiate(zend_class_entry *, zval *);
128127
static zend_result tidy_doc_cast_handler(zend_object *, zval *, int);
129128
static zend_result tidy_node_cast_handler(zend_object *, zval *, int);
130129
static void tidy_doc_update_properties(PHPTidyObj *);
@@ -273,7 +272,7 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, const char *optname, zval *value)
273272

274273
static void tidy_create_node_object(zval *zv, PHPTidyDoc *ptdoc, TidyNode node)
275274
{
276-
tidy_instantiate(tidy_ce_node, zv);
275+
object_init_ex(zv, tidy_ce_node);
277276
PHPTidyObj *newobj = Z_TIDY_P(zv);
278277
newobj->node = node;
279278
newobj->type = is_node;
@@ -469,12 +468,6 @@ static zend_object *tidy_object_new_doc(zend_class_entry *class_type)
469468
return tidy_object_new(class_type, &tidy_object_handlers_doc, is_doc);
470469
}
471470

472-
static zval *tidy_instantiate(zend_class_entry *pce, zval *object)
473-
{
474-
object_init_ex(object, pce);
475-
return object;
476-
}
477-
478471
static zend_result tidy_doc_cast_handler(zend_object *in, zval *out, int type)
479472
{
480473
TidyBuffer output;
@@ -1018,7 +1011,7 @@ PHP_FUNCTION(tidy_parse_string)
10181011
RETURN_THROWS();
10191012
}
10201013

1021-
tidy_instantiate(tidy_ce_doc, return_value);
1014+
object_init_ex(return_value, tidy_ce_doc);
10221015
obj = Z_TIDY_P(return_value);
10231016

10241017
if (php_tidy_apply_config(obj->ptdoc->doc, options_str, options_ht) != SUCCESS
@@ -1086,7 +1079,7 @@ PHP_FUNCTION(tidy_parse_file)
10861079
RETURN_THROWS();
10871080
}
10881081

1089-
tidy_instantiate(tidy_ce_doc, return_value);
1082+
object_init_ex(return_value, tidy_ce_doc);
10901083
obj = Z_TIDY_P(return_value);
10911084

10921085
if (php_tidy_apply_config(obj->ptdoc->doc, options_str, options_ht) != SUCCESS

0 commit comments

Comments
 (0)