mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Correctly account for the Spaces array nul terminator. Thanks Chris!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79894 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -304,11 +304,12 @@ raw_ostream &raw_ostream::indent(unsigned NumSpaces) {
|
|||||||
" ";
|
" ";
|
||||||
|
|
||||||
// Usually the indentation is small, handle it with a fastpath.
|
// Usually the indentation is small, handle it with a fastpath.
|
||||||
if (NumSpaces <= array_lengthof(Spaces))
|
if (NumSpaces < array_lengthof(Spaces))
|
||||||
return write(Spaces, NumSpaces);
|
return write(Spaces, NumSpaces);
|
||||||
|
|
||||||
while (NumSpaces) {
|
while (NumSpaces) {
|
||||||
unsigned NumToWrite = std::min(NumSpaces, (unsigned)array_lengthof(Spaces));
|
unsigned NumToWrite = std::min(NumSpaces,
|
||||||
|
(unsigned)array_lengthof(Spaces)-1);
|
||||||
write(Spaces, NumToWrite);
|
write(Spaces, NumToWrite);
|
||||||
NumSpaces -= NumToWrite;
|
NumSpaces -= NumToWrite;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user