mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
strnlen isn't available on some platforms, use StringRef instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224679 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3664,7 +3664,8 @@ static void PrintLinkerOptionCommand(MachO::linker_option_command lo,
|
|||||||
if (left > 0) {
|
if (left > 0) {
|
||||||
i++;
|
i++;
|
||||||
outs() << " string #" << i << " " << format("%.*s\n", left, string);
|
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;
|
string += len;
|
||||||
left -= len;
|
left -= len;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user