]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Allow VG_(atoll16) to accept a leading "0x".
authorJulian Seward <jseward@acm.org>
Fri, 9 Nov 2007 23:25:46 +0000 (23:25 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 9 Nov 2007 23:25:46 +0000 (23:25 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7125

coregrind/m_libcbase.c
include/pub_tool_libcbase.h

index a1f073cb3923bde1bfa39f1c36adab45f7cd7b9f..698772839c7d0563d104fd4ab94f7b9e3308d324 100644 (file)
@@ -68,6 +68,9 @@ Long VG_(atoll16) ( Char* str )
    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') {
index 658aedb4f343b2946a89fd42448a31e40e742fc0..f282bfd755901dec0a2f4a18a02bedf9c1daae4b 100644 (file)
@@ -42,10 +42,9 @@ extern Bool VG_(isdigit) ( Char c );
    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