|
From: <sv...@va...> - 2007-11-09 23:25:55
|
Author: sewardj
Date: 2007-11-09 23:25:46 +0000 (Fri, 09 Nov 2007)
New Revision: 7125
Log:
Allow VG_(atoll16) to accept a leading "0x".
Modified:
trunk/coregrind/m_libcbase.c
trunk/include/pub_tool_libcbase.h
Modified: trunk/coregrind/m_libcbase.c
===================================================================
--- trunk/coregrind/m_libcbase.c 2007-11-09 23:24:09 UTC (rev 7124)
+++ trunk/coregrind/m_libcbase.c 2007-11-09 23:25:46 UTC (rev 7125)
@@ -68,6 +68,9 @@
Bool neg = False;
Long n = 0;
if (*str == '-') { str++; neg = True; };
+ if (*str == '0' && (*(str+1) == 'x' || *(str+1) == 'X')) {
+ str += 2;
+ }
while (True) {
Char c = *str;
if (c >= '0' && c <= (Char)'9') {
Modified: trunk/include/pub_tool_libcbase.h
===================================================================
--- trunk/include/pub_tool_libcbase.h 2007-11-09 23:24:09 UTC (rev 7124)
+++ trunk/include/pub_tool_libcbase.h 2007-11-09 23:25:46 UTC (rev 7125)
@@ -42,10 +42,9 @@
Converting strings to numbers
------------------------------------------------------------------ */
- // Nb: atoll16 doesn't handle a "0x" prefix.
-extern Long VG_(atoll) ( Char* str ); // base 10
-extern Long VG_(atoll16) ( Char* str ); // base 16
-extern Long VG_(atoll36) ( Char* str ); // base 36
+extern Long VG_(atoll) ( Char* str ); // base 10
+extern Long VG_(atoll16) ( Char* str ); // base 16; leading 0x accepted
+extern Long VG_(atoll36) ( Char* str ); // base 36
/* ---------------------------------------------------------------------
String functions and macros
|