Skip to content

Xsl dom objects free storage upd#21533

Merged
devnexen merged 1 commit intophp:masterfrom
devnexen:xsl_dom_objects_free_storage_upd
Mar 26, 2026
Merged

Xsl dom objects free storage upd#21533
devnexen merged 1 commit intophp:masterfrom
devnexen:xsl_dom_objects_free_storage_upd

Conversation

@devnexen
Copy link
Member

No description provided.

@devnexen devnexen marked this pull request as ready for review March 26, 2026 18:38
@devnexen devnexen requested a review from ndossche as a code owner March 26, 2026 18:38
cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_R, NULL, &rv);
clone_docu = zend_is_true(cloneDocu);
zend_string_release_ex(member, 0);
cloneDocu = xsl_prop_clone_document(Z_OBJ_P(id));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid a zend_string allocation + property hash lookup per call. maxTemplateDepth and maxTemplateVars already use direct slot access via XSL_DEFINE_PROP_ACCESSOR —
this brings doXInclude and cloneDocument in line with the same pattern. but I put these in separate commit just in case :)

ctxt->xinclude = zend_is_true(doXInclude);
zend_string_release_ex(member, 0);
doXInclude = xsl_prop_do_xinclude(Z_OBJ_P(id));
ctxt->xinclude = !Z_ISUNDEF_P(doXInclude) && zend_is_true(doXInclude);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to check for Z_ISUNDEF_P, zend_is_true will do this properly.

clone_docu = zend_is_true(cloneDocu);
zend_string_release_ex(member, 0);
cloneDocu = xsl_prop_clone_document(Z_OBJ_P(id));
clone_docu = !Z_ISUNDEF_P(cloneDocu) && zend_is_true(cloneDocu);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


XSL_DEFINE_PROP_ACCESSOR(max_template_depth, "maxTemplateDepth", 2)
XSL_DEFINE_PROP_ACCESSOR(max_template_vars, "maxTemplateVars", 3)
XSL_DEFINE_PROP_ACCESSOR(do_xinclude, "doXInclude", 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reorder these such that they last argument goes from 0 to 1 to 2 to 3.

… slot access for doXInclude and cloneDocument.

The node and its document are validated before cloning, making
the subsequent NULL checks on nodep and newdoc redundant.

Use OBJ_PROP_NUM via XSL_DEFINE_PROP_ACCESSOR for doXInclude and
cloneDocument, avoiding zend_string allocation and property hash
lookup per call.
@devnexen devnexen force-pushed the xsl_dom_objects_free_storage_upd branch from 3b6d043 to 8b77a64 Compare March 26, 2026 21:59
@devnexen devnexen merged commit 8df516c into php:master Mar 26, 2026
19 checks passed
@devnexen devnexen deleted the xsl_dom_objects_free_storage_upd branch March 26, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants