diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-06-03 07:12:51 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-06-03 07:12:51 +0000 |
commit | f9c78551437bace4404cafdde632af947309161c (patch) | |
tree | 2381aa510a0e06356071e9ae4aecedeed68dad12 | |
parent | 63e29e1d1ef8ee37f21b2d9852eba9959d00b82f (diff) |
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
-rw-r--r-- | src/pugixml.cpp | 15 | ||||
-rw-r--r-- | src/pugixpath.cpp | 2 |
2 files changed, 2 insertions, 15 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 6dcdbf6..5b668b0 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -99,7 +99,6 @@ namespace pugi 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);
void widen_ascii(wchar_t* dest, const char* source);
}
@@ -120,16 +119,6 @@ namespace pugi #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
bool PUGIXML_FUNCTION strequal(const char_t* src, const char_t* dst)
{
@@ -1336,7 +1325,7 @@ namespace if (dest && impl::strlen(dest) >= source_length)
{
- impl::strcpy(dest, source);
+ memcpy(dest, source, (source_length + 1) * sizeof(char_t));
return true;
}
@@ -1347,7 +1336,7 @@ namespace char_t* buf = alloc->allocate_string(source_length + 1);
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);
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index 77d1e71..8e35478 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -52,8 +52,6 @@ namespace pugi {
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);
void widen_ascii(wchar_t* dest, const char* source);
}
|