diff options
author | Neil <nyamatongwe@gmail.com> | 2019-05-02 14:14:08 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-05-02 14:14:08 +1000 |
commit | fd00af6bd9cb38ab9719bce0c1360c395c026a8d (patch) | |
tree | 57691e97c9f237898f5a10a4ede135a29d7b88b4 /src | |
parent | e703a397f626208f54703d8af54f31f21c88259d (diff) | |
download | scintilla-mirror-fd00af6bd9cb38ab9719bce0c1360c395c026a8d.tar.gz |
Optimize SCI_GETTEXT by calling Document::GetCharRange instead of looping for
each byte.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 352a133ae..42b71e3c8 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5796,11 +5796,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { if (wParam == 0) return 0; char *ptr = CharPtrFromSPtr(lParam); - size_t iChar = 0; - for (; iChar < wParam - 1; iChar++) - ptr[iChar] = pdoc->CharAt(iChar); - ptr[iChar] = '\0'; - return iChar; + const Sci_Position len = wParam - 1; + pdoc->GetCharRange(ptr, 0, len); + ptr[len] = '\0'; + return len; } case SCI_SETTEXT: { |