eliminate a use of strtoul.
authorChris Lattner <sabre@nondot.org>
Sun, 20 Sep 2009 06:58:54 +0000 (06:58 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 20 Sep 2009 06:58:54 +0000 (06:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82382 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCSectionMachO.cpp

index 32d908ff68520df48999925d8ff58434604e5be9..33f5087d1efb3004740d0b41d29a803e1fb9f5e4 100644 (file)
@@ -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 "";