summaryrefslogtreecommitdiff
path: root/lib/MC
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
commitd9221d75f02a81eec9c22473b4f2a809d83bf60a (patch)
treef94d816a5cf6e36b527d635d549d7051e612ceae /lib/MC
parent67c6b6ee71826b2c48b4da490340e5c3e2a94cd2 (diff)
downloadllvm-d9221d75f02a81eec9c22473b4f2a809d83bf60a.tar.gz
llvm-d9221d75f02a81eec9c22473b4f2a809d83bf60a.tar.bz2
llvm-d9221d75f02a81eec9c22473b4f2a809d83bf60a.tar.xz
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')
-rw-r--r--lib/MC/MCSectionMachO.cpp14
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 "";