[llvm-commits] [llvm] r82382 - /llvm/trunk/lib/MC/MCSectionMachO.cpp

Chris Lattner sabre at nondot.org
Sat Sep 19 23:58:55 PDT 2009


Author: lattner
Date: Sun Sep 20 01:58:54 2009
New Revision: 82382

URL: http://llvm.org/viewvc/llvm-project?rev=82382&view=rev
Log:
eliminate a use of strtoul.

Modified:
    llvm/trunk/lib/MC/MCSectionMachO.cpp

Modified: llvm/trunk/lib/MC/MCSectionMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionMachO.cpp?rev=82382&r1=82381&r2=82382&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCSectionMachO.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionMachO.cpp Sun Sep 20 01:58:54 2009
@@ -260,18 +260,8 @@
   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 "";





More information about the llvm-commits mailing list