From: Julian Seward Date: Fri, 9 Nov 2007 23:25:46 +0000 (+0000) Subject: Allow VG_(atoll16) to accept a leading "0x". X-Git-Tag: svn/VALGRIND_3_3_0~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e9e59f46b71b7b8e8550749cd7af09a6be590fb;p=thirdparty%2Fvalgrind.git Allow VG_(atoll16) to accept a leading "0x". git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7125 --- diff --git a/coregrind/m_libcbase.c b/coregrind/m_libcbase.c index a1f073cb39..698772839c 100644 --- a/coregrind/m_libcbase.c +++ b/coregrind/m_libcbase.c @@ -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') { diff --git a/include/pub_tool_libcbase.h b/include/pub_tool_libcbase.h index 658aedb4f3..f282bfd755 100644 --- a/include/pub_tool_libcbase.h +++ b/include/pub_tool_libcbase.h @@ -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