[llvm] r224679 - strnlen isn't available on some platforms, use StringRef instead
David Majnemer
david.majnemer at gmail.com
Sat Dec 20 00:24:44 PST 2014
Author: majnemer
Date: Sat Dec 20 02:24:43 2014
New Revision: 224679
URL: http://llvm.org/viewvc/llvm-project?rev=224679&view=rev
Log:
strnlen isn't available on some platforms, use StringRef instead
Modified:
llvm/trunk/tools/llvm-objdump/MachODump.cpp
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=224679&r1=224678&r2=224679&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Sat Dec 20 02:24:43 2014
@@ -3664,7 +3664,8 @@ static void PrintLinkerOptionCommand(Mac
if (left > 0) {
i++;
outs() << " string #" << i << " " << format("%.*s\n", left, string);
- uint32_t len = strnlen(string, left) + 1;
+ uint32_t NullPos = StringRef(string, left).find('\0');
+ uint32_t len = std::min(NullPos, left) + 1;
string += len;
left -= len;
}
More information about the llvm-commits
mailing list