aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCSectionMachO.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-20 06:58:54 +0000
committerChris Lattner <sabre@nondot.org>2009-09-20 06:58:54 +0000
commita15f0044a0c50f48ef1e5abe111c6e1c1aec4027 (patch)
treebb342c1be5eca8931b4c380750a259510049e653 /llvm/lib/MC/MCSectionMachO.cpp
parent17ec6b11d2efd2996c27455c5294bd5981712f9d (diff)
downloadllvm-a15f0044a0c50f48ef1e5abe111c6e1c1aec4027.zip
llvm-a15f0044a0c50f48ef1e5abe111c6e1c1aec4027.tar.gz
llvm-a15f0044a0c50f48ef1e5abe111c6e1c1aec4027.tar.bz2
eliminate a use of strtoul.
llvm-svn: 82382
Diffstat (limited to 'llvm/lib/MC/MCSectionMachO.cpp')
-rw-r--r--llvm/lib/MC/MCSectionMachO.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/llvm/lib/MC/MCSectionMachO.cpp b/llvm/lib/MC/MCSectionMachO.cpp
index 32d908f..33f5087d 100644
--- a/llvm/lib/MC/MCSectionMachO.cpp
+++ b/llvm/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 "";