[llvm-commits] [llvm] r79894 - /llvm/trunk/lib/Support/raw_ostream.cpp
Dan Gohman
gohman at apple.com
Sun Aug 23 21:43:39 PDT 2009
Author: djg
Date: Sun Aug 23 23:43:38 2009
New Revision: 79894
URL: http://llvm.org/viewvc/llvm-project?rev=79894&view=rev
Log:
Correctly account for the Spaces array nul terminator. Thanks Chris!
Modified:
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79894&r1=79893&r2=79894&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Sun Aug 23 23:43:38 2009
@@ -304,11 +304,12 @@
" ";
// Usually the indentation is small, handle it with a fastpath.
- if (NumSpaces <= array_lengthof(Spaces))
+ if (NumSpaces < array_lengthof(Spaces))
return write(Spaces, 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);
NumSpaces -= NumToWrite;
}
More information about the llvm-commits
mailing list