Skip to content

Commit 475b6ab

Browse files
Marc-Etienne Barrutclaude
andcommitted
style cleanup in setvalue
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fb9b9f6 commit 475b6ab

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

rapidxml/c_ext/src/base_object.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,13 @@ static int rapidxml_BaseObject_setvalue(rapidxml_BaseObject* self,
166166
char* new_value = self->document->allocate_string(static_cast<const char*>(value.buf));
167167
self->underlying_obj->value(new_value);
168168
if (IS_NODE(reinterpret_cast<PyObject*>(self))) {
169-
rapidxml::xml_node<>* node =
170-
static_cast<rapidxml::xml_node<>*>(self->underlying_obj);
169+
rapidxml::xml_node<>* node = static_cast<rapidxml::xml_node<>*>(self->underlying_obj);
171170
if (node->type() == rapidxml::node_element) {
172-
/*
173-
** When the document is parsed with data nodes (parse_cdata=True),
174-
** the element value is held by data/cdata children, which take
175-
** precedence over the element value when printing.
176-
** Keep them in sync: update the first one, drop the others.
177-
*/
178171
rapidxml::xml_node<>* child = node->first_node();
179172
bool found = false;
180-
while (child != NULL) {
173+
while (child) {
181174
rapidxml::xml_node<>* next = child->next_sibling();
182-
if (child->type() == rapidxml::node_data ||
183-
child->type() == rapidxml::node_cdata) {
175+
if (child->type() == rapidxml::node_data || child->type() == rapidxml::node_cdata) {
184176
if (!found) {
185177
child->value(new_value);
186178
found = true;

0 commit comments

Comments
 (0)