summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/clang-format.py
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools/clang-format/clang-format.py')
-rw-r--r--clang/tools/clang-format/clang-format.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py
index 60e2e550289..29be72e176b 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/tools/clang-format/clang-format.py
@@ -71,8 +71,8 @@ else:
output = json.loads(lines[0])
lines = lines[1:]
if '\n'.join(lines) != text:
- for i in range(min(len(buf), len(lines))):
- buf[i] = lines[i]
+ common_length = min(len(buf), len(lines))
+ buf[:common_length] = lines[:common_length]
for line in lines[len(buf):]:
buf.append(line)
del buf[len(lines):]
OpenPOWER on IntegriCloud