Skip to content

Minor cleanup in dom_character_data_append_data #15173

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

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions ext/dom/characterdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,34 +154,30 @@ PHP_METHOD(DOMCharacterData, substringData)
Modern spec URL: https://dom.spec.whatwg.org/#dom-characterdata-appenddata
Since:
*/
static void dom_character_data_append_data(INTERNAL_FUNCTION_PARAMETERS, bool return_true)
static void dom_character_data_append_data(INTERNAL_FUNCTION_PARAMETERS)
{
zval *id;
xmlNode *nodep;
dom_object *intern;
char *arg;
size_t arg_len;

id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
RETURN_THROWS();
}

DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
DOM_GET_OBJ(nodep, ZEND_THIS, xmlNodePtr, intern);
xmlTextConcat(nodep, BAD_CAST arg, arg_len);
if (return_true) {
RETURN_TRUE;
}
}

PHP_METHOD(DOMCharacterData, appendData)
{
dom_character_data_append_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
dom_character_data_append_data(INTERNAL_FUNCTION_PARAM_PASSTHRU);
RETURN_TRUE;
}

PHP_METHOD(Dom_CharacterData, appendData)
{
dom_character_data_append_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
dom_character_data_append_data(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} end dom_characterdata_append_data */

Expand Down
Loading