diff options
author | Chris Lattner <sabre@nondot.org> | 2009-09-20 06:58:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-09-20 06:58:54 +0000 |
commit | fc71ac06870a72ae5c040e28f30c8064db85af48 (patch) | |
tree | f94d816a5cf6e36b527d635d549d7051e612ceae /lib/MC/MCSectionMachO.cpp | |
parent | 14267fcd04c922b6c52d7b9bb474479e5bf57889 (diff) | |
download | external_llvm-fc71ac06870a72ae5c040e28f30c8064db85af48.tar.gz external_llvm-fc71ac06870a72ae5c040e28f30c8064db85af48.tar.bz2 external_llvm-fc71ac06870a72ae5c040e28f30c8064db85af48.zip |
eliminate a use of strtoul.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCSectionMachO.cpp')
-rw-r--r-- | lib/MC/MCSectionMachO.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/MC/MCSectionMachO.cpp b/lib/MC/MCSectionMachO.cpp index 32d908ff68..33f5087d1e 100644 --- a/lib/MC/MCSectionMachO.cpp +++ b/lib/MC/MCSectionMachO.cpp @@ -260,18 +260,8 @@ std::string MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In. StringRef StubSizeStr = Comma.second; StripSpaces(StubSizeStr); - // Convert the a null terminated buffer for strtoul. - char TmpBuffer[32]; - if (StubSizeStr.size() >= 32) - return"mach-o section specifier has a stub size specifier that is too long"; - - memcpy(TmpBuffer, StubSizeStr.data(), StubSizeStr.size()); - TmpBuffer[StubSizeStr.size()] = 0; - - char *EndPtr; - StubSize = strtoul(TmpBuffer, &EndPtr, 0); - - if (EndPtr[0] != 0) + // Convert the stub size from a string to an integer. + if (StubSizeStr.getAsInteger(0, StubSize)) return "mach-o section specifier has a malformed stub size"; return ""; |