Minor strcpy_insitu optimization for large strings, removed now redundant impl::strcpy
git-svn-id: http://pugixml.googlecode.com/svn/trunk@502 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
63e29e1d1e
commit
f9c7855143
@ -99,7 +99,6 @@ namespace pugi
|
|||||||
namespace impl
|
namespace impl
|
||||||
{
|
{
|
||||||
size_t strlen(const char_t* s);
|
size_t strlen(const char_t* s);
|
||||||
void strcpy(char_t* dst, const char_t* src);
|
|
||||||
bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count);
|
bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count);
|
||||||
void widen_ascii(wchar_t* dest, const char* source);
|
void widen_ascii(wchar_t* dest, const char* source);
|
||||||
}
|
}
|
||||||
@ -120,16 +119,6 @@ namespace pugi
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy one string into another
|
|
||||||
void strcpy(char_t* dst, const char_t* src)
|
|
||||||
{
|
|
||||||
#ifdef PUGIXML_WCHAR_MODE
|
|
||||||
wcscpy(dst, src);
|
|
||||||
#else
|
|
||||||
::strcpy(dst, src);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compare two strings
|
// Compare two strings
|
||||||
bool PUGIXML_FUNCTION strequal(const char_t* src, const char_t* dst)
|
bool PUGIXML_FUNCTION strequal(const char_t* src, const char_t* dst)
|
||||||
{
|
{
|
||||||
@ -1336,7 +1325,7 @@ namespace
|
|||||||
|
|
||||||
if (dest && impl::strlen(dest) >= source_length)
|
if (dest && impl::strlen(dest) >= source_length)
|
||||||
{
|
{
|
||||||
impl::strcpy(dest, source);
|
memcpy(dest, source, (source_length + 1) * sizeof(char_t));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1347,7 +1336,7 @@ namespace
|
|||||||
char_t* buf = alloc->allocate_string(source_length + 1);
|
char_t* buf = alloc->allocate_string(source_length + 1);
|
||||||
if (!buf) return false;
|
if (!buf) return false;
|
||||||
|
|
||||||
impl::strcpy(buf, source);
|
memcpy(buf, source, (source_length + 1) * sizeof(char_t));
|
||||||
|
|
||||||
if (header & header_mask) alloc->deallocate_string(dest);
|
if (header & header_mask) alloc->deallocate_string(dest);
|
||||||
|
|
||||||
|
|||||||
@ -52,8 +52,6 @@ namespace pugi
|
|||||||
{
|
{
|
||||||
namespace impl
|
namespace impl
|
||||||
{
|
{
|
||||||
size_t strlen(const char_t* s);
|
|
||||||
void strcpy(char_t* dst, const char_t* src);
|
|
||||||
bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count);
|
bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count);
|
||||||
void widen_ascii(wchar_t* dest, const char* source);
|
void widen_ascii(wchar_t* dest, const char* source);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user