aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorZufu Liu <unknown>2019-05-24 12:49:38 +1000
committerZufu Liu <unknown>2019-05-24 12:49:38 +1000
commit6dde89cb0f4642889500e564022d75fd57ce8af6 (patch)
treeba079eab4e6621b90af69e67c7757b7a8caa816e /src
parent363c7f6ae1050ce8c74f4c35a4fb485f82bcc27a (diff)
downloadscintilla-mirror-6dde89cb0f4642889500e564022d75fd57ce8af6.tar.gz
Optimize SCI_GETSELTEXT by avoiding per-character calls.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 07b05dbc9..6ad81e685 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -5928,10 +5928,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return selectedText.LengthWithTerminator();
} else {
char *ptr = CharPtrFromSPtr(lParam);
- size_t iChar = 0;
- if (selectedText.Length()) {
- for (; iChar < selectedText.LengthWithTerminator(); iChar++)
- ptr[iChar] = selectedText.Data()[iChar];
+ size_t iChar = selectedText.Length();
+ if (iChar) {
+ memcpy(ptr, selectedText.Data(), iChar);
+ ptr[iChar++] = '\0';
} else {
ptr[0] = '\0';
}