0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-31 00:13:01 +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:
arseny.kapoulkine 2010-08-29 15:54:18 +00:00
parent 9a0464bdc2
commit 589947da0b

View File

@ -4751,16 +4751,10 @@ namespace
{
assert(begin <= end);
if (begin != end)
{
_buffer = duplicate_string(begin, static_cast<size_t>(end - begin));
_uses_heap = true;
}
else
{
_buffer = PUGIXML_TEXT("");
_uses_heap = false;
}
bool empty = (begin == end);
_buffer = empty ? PUGIXML_TEXT("") : duplicate_string(begin, static_cast<size_t>(end - begin));
_uses_heap = !empty;
}
xpath_string(const xpath_string& o)
@ -4788,11 +4782,10 @@ namespace
// skip empty sources
if (!*o._buffer) return;
// fast append for empty target and constant source
if (!*_buffer && !o._uses_heap)
// fast append for constant empty target and constant source
if (!*_buffer && !_uses_heap && !o._uses_heap)
{
_buffer = o._buffer;
_uses_heap = false;
}
else
{