mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-03 01:55:25 +08:00
XPath: Minor xpath_string refactoring, minor xpath_string::append fix
git-svn-id: http://pugixml.googlecode.com/svn/trunk@701 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
9a0464bdc2
commit
589947da0b
@ -4751,16 +4751,10 @@ namespace
|
|||||||
{
|
{
|
||||||
assert(begin <= end);
|
assert(begin <= end);
|
||||||
|
|
||||||
if (begin != end)
|
bool empty = (begin == end);
|
||||||
{
|
|
||||||
_buffer = duplicate_string(begin, static_cast<size_t>(end - begin));
|
_buffer = empty ? PUGIXML_TEXT("") : duplicate_string(begin, static_cast<size_t>(end - begin));
|
||||||
_uses_heap = true;
|
_uses_heap = !empty;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_buffer = PUGIXML_TEXT("");
|
|
||||||
_uses_heap = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xpath_string(const xpath_string& o)
|
xpath_string(const xpath_string& o)
|
||||||
@ -4788,11 +4782,10 @@ namespace
|
|||||||
// skip empty sources
|
// skip empty sources
|
||||||
if (!*o._buffer) return;
|
if (!*o._buffer) return;
|
||||||
|
|
||||||
// fast append for empty target and constant source
|
// fast append for constant empty target and constant source
|
||||||
if (!*_buffer && !o._uses_heap)
|
if (!*_buffer && !_uses_heap && !o._uses_heap)
|
||||||
{
|
{
|
||||||
_buffer = o._buffer;
|
_buffer = o._buffer;
|
||||||
_uses_heap = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user