Use new mask cover all tests
This commit is contained in:
parent
dbedd144ff
commit
1a5288047e
@ -432,15 +432,18 @@ PUGI__NS_BEGIN
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// extra metadata bits
|
// extra metadata bits
|
||||||
|
static const uintptr_t xml_memory_page_contents_const_mask = 128;
|
||||||
static const uintptr_t xml_memory_page_contents_shared_mask = 64;
|
static const uintptr_t xml_memory_page_contents_shared_mask = 64;
|
||||||
static const uintptr_t xml_memory_page_name_allocated_mask = 32;
|
static const uintptr_t xml_memory_page_name_allocated_mask = 32;
|
||||||
static const uintptr_t xml_memory_page_value_allocated_mask = 16;
|
static const uintptr_t xml_memory_page_value_allocated_mask = 16;
|
||||||
static const uintptr_t xml_memory_page_type_mask = 15;
|
static const uintptr_t xml_memory_page_type_mask = 15;
|
||||||
|
|
||||||
// combined masks for string uniqueness
|
// combined masks for string uniqueness
|
||||||
|
static const uintptr_t xml_memory_page_contents_const_or_shared_mask = xml_memory_page_contents_const_mask | xml_memory_page_contents_shared_mask;
|
||||||
static const uintptr_t xml_memory_page_name_allocated_or_shared_mask = xml_memory_page_name_allocated_mask | xml_memory_page_contents_shared_mask;
|
static const uintptr_t xml_memory_page_name_allocated_or_shared_mask = xml_memory_page_name_allocated_mask | xml_memory_page_contents_shared_mask;
|
||||||
static const uintptr_t xml_memory_page_value_allocated_or_shared_mask = xml_memory_page_value_allocated_mask | xml_memory_page_contents_shared_mask;
|
static const uintptr_t xml_memory_page_value_allocated_or_shared_mask = xml_memory_page_value_allocated_mask | xml_memory_page_contents_shared_mask;
|
||||||
|
|
||||||
|
|
||||||
#ifdef PUGIXML_COMPACT
|
#ifdef PUGIXML_COMPACT
|
||||||
#define PUGI__GETHEADER_IMPL(object, page, flags) // unused
|
#define PUGI__GETHEADER_IMPL(object, page, flags) // unused
|
||||||
#define PUGI__GETPAGE_IMPL(header) (header).get_page()
|
#define PUGI__GETPAGE_IMPL(header) (header).get_page()
|
||||||
@ -2340,7 +2343,7 @@ PUGI__NS_BEGIN
|
|||||||
inline bool strcpy_insitu_allow(size_t length, const Header& header, uintptr_t header_mask, char_t* target)
|
inline bool strcpy_insitu_allow(size_t length, const Header& header, uintptr_t header_mask, char_t* target)
|
||||||
{
|
{
|
||||||
// never reuse shared memory
|
// never reuse shared memory
|
||||||
if (header & xml_memory_page_contents_shared_mask) return false;
|
if (header & xml_memory_page_contents_const_or_shared_mask) return false;
|
||||||
|
|
||||||
size_t target_length = strlength(target);
|
size_t target_length = strlength(target);
|
||||||
|
|
||||||
@ -2368,7 +2371,7 @@ PUGI__NS_BEGIN
|
|||||||
header &= ~header_mask;
|
header &= ~header_mask;
|
||||||
|
|
||||||
// mark dest as shared to avoid reuse document buffer memory
|
// mark dest as shared to avoid reuse document buffer memory
|
||||||
header |= xml_memory_page_contents_shared_mask;
|
header |= xml_memory_page_contents_const_mask;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2402,7 +2405,7 @@ PUGI__NS_BEGIN
|
|||||||
header |= header_mask;
|
header |= header_mask;
|
||||||
|
|
||||||
// remove dest shared mask for continue reuse document buffer memory
|
// remove dest shared mask for continue reuse document buffer memory
|
||||||
header &= ~xml_memory_page_contents_shared_mask;
|
header &= ~xml_memory_page_contents_const_mask;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user