diff options
author | Neil <nyamatongwe@gmail.com> | 2021-04-28 18:56:12 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-04-28 18:56:12 +1000 |
commit | 46051d8aa40c69e17e3e4d108bc2fa8d5694de75 (patch) | |
tree | 73614c8a36e6ad828d717af6447c01207c559591 | |
parent | 835f8b011b4d0db3ce82b296cd00e06952e07363 (diff) | |
download | scintilla-mirror-46051d8aa40c69e17e3e4d108bc2fa8d5694de75.tar.gz |
Use copy instead of loop and rely on make_unique zeroing result.
-rw-r--r-- | src/PositionCache.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 0a9ef259a..a3e8e74f8 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -179,11 +179,8 @@ void LineLayout::SetLineStart(int line, int start) { if ((line >= lenLineStarts) && (line != 0)) { const int newMaxLines = line + 20; std::unique_ptr<int[]> newLineStarts = std::make_unique<int[]>(newMaxLines); - for (int i = 0; i < newMaxLines; i++) { - if (i < lenLineStarts) - newLineStarts[i] = lineStarts[i]; - else - newLineStarts[i] = 0; + if (lenLineStarts) { + std::copy(lineStarts.get(), lineStarts.get() + lenLineStarts, newLineStarts.get()); } lineStarts = std::move(newLineStarts); lenLineStarts = newMaxLines; |