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 | d9221d75f02a81eec9c22473b4f2a809d83bf60a (patch) | |
tree | f94d816a5cf6e36b527d635d549d7051e612ceae /lib/MC/MCSectionMachO.cpp | |
parent | 67c6b6ee71826b2c48b4da490340e5c3e2a94cd2 (diff) | |
download | external_llvm-d9221d75f02a81eec9c22473b4f2a809d83bf60a.zip external_llvm-d9221d75f02a81eec9c22473b4f2a809d83bf60a.tar.gz external_llvm-d9221d75f02a81eec9c22473b4f2a809d83bf60a.tar.bz2 |
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 32d908f..33f5087 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 ""; |