[llvm-commits] [llvm] r160744 - /llvm/trunk/lib/Support/APFloat.cpp
David Blaikie
dblaikie at gmail.com
Wed Jul 25 11:04:25 PDT 2012
Author: dblaikie
Date: Wed Jul 25 13:04:24 2012
New Revision: 160744
URL: http://llvm.org/viewvc/llvm-project?rev=160744&view=rev
Log:
Don't add null characters to the end of the APFloat string buffer.
Report/patch inspiration by Olaf Krzikalla.
Modified:
llvm/trunk/lib/Support/APFloat.cpp
Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=160744&r1=160743&r2=160744&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Wed Jul 25 13:04:24 2012
@@ -3278,16 +3278,8 @@
}
namespace {
- static void append(SmallVectorImpl<char> &Buffer,
- unsigned N, const char *Str) {
- unsigned Start = Buffer.size();
- Buffer.set_size(Start + N);
- memcpy(&Buffer[Start], Str, N);
- }
-
- template <unsigned N>
- void append(SmallVectorImpl<char> &Buffer, const char (&Str)[N]) {
- append(Buffer, N, Str);
+ void append(SmallVectorImpl<char> &Buffer, StringRef Str) {
+ Buffer.append(Str.begin(), Str.end());
}
/// Removes data from the given significand until it is no more
More information about the llvm-commits
mailing list