mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
xml_node: skip whitespace in differs_from
The 'Xml_node::differs_from' method takes the constructor arguments (addr, size) for a byte-wise comparison whereas 'with_raw_node' restricts the byte range to the actual XML tags. In cases where the XML start tag is preceeded by whitespace, both ranges can differ. Since the 'differs_from' method is meant for comparing actual XML nodes - not any whitespace around them - whitespace should be ignored on both operands. Issue #5029
This commit is contained in:
parent
1b23d3b8cb
commit
87b7dfed5d
@ -1041,10 +1041,14 @@ class Genode::Xml_node
|
||||
/**
|
||||
* Return true if this node differs from 'another'
|
||||
*/
|
||||
bool differs_from(Xml_node const &another) const
|
||||
bool differs_from(Xml_node const &other) const
|
||||
{
|
||||
return size() != another.size() ||
|
||||
memcmp(_addr, another._addr, size()) != 0;
|
||||
bool result = false;
|
||||
other.with_raw_node([&] (char const * const other_start, size_t other_len) {
|
||||
with_raw_node([&] (char const * const start, size_t len) {
|
||||
result = (len != other_len)
|
||||
|| (memcmp(start, other_start, len) != 0); }); });
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user