diff options
author | Zufu Liu <unknown> | 2019-05-24 12:49:38 +1000 |
---|---|---|
committer | Zufu Liu <unknown> | 2019-05-24 12:49:38 +1000 |
commit | 1ae8e46fc55d378679d33700635c730c55038deb (patch) | |
tree | af9d3b38feed6be726ba23217647e8d26588cee7 /src | |
parent | 810edc4827347f3e0c1bc4d835c6f7a58e8bd66c (diff) | |
download | scintilla-mirror-1ae8e46fc55d378679d33700635c730c55038deb.tar.gz |
Backport: Optimize SCI_GETSELTEXT by avoiding per-character calls.
Backport of changeset 7505:1de0cb213456.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index ffbf4e0ef..ca63c808d 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5924,10 +5924,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'; } |