-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor improvements to ext/xml memory management #18071
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems sensible to me
Ah great, now Windows fails ffs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
ext/xml/xml.c
Outdated
zend_string *stripped_tag = xml_stripped_tag(tag_name, parser->toffset); | ||
xml_add_to_info(parser, stripped_tag); | ||
|
||
add_assoc_string(&tag, "tag", skipped_tag_name); | ||
add_assoc_str(&tag, "tag", stripped_tag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to add a comment to indicate that you are transferring the lifetime of the str to the tag array?
@@ -749,17 +759,19 @@ void xml_endElementHandler(void *userData, const XML_Char *name) | |||
add_assoc_string(zv, "type", "complete"); | |||
} | |||
} else { | |||
char *skipped_tag_name = SKIP_TAGSTART(ZSTR_VAL(tag_name)); | |||
zend_string *stripped_tag = xml_stripped_tag(tag_name, parser->toffset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
ext/xml/xml.c
Outdated
zend_string *stripped_tag = xml_stripped_tag(parser->ltags[parser->level - 1], parser->toffset); | ||
xml_add_to_info(parser, stripped_tag); | ||
add_assoc_str(&tag, "tag", stripped_tag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
No description provided.