From 6e9e59f46b71b7b8e8550749cd7af09a6be590fb Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Fri, 9 Nov 2007 23:25:46 +0000 Subject: [PATCH] Allow VG_(atoll16) to accept a leading "0x". git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7125 --- coregrind/m_libcbase.c | 3 +++ include/pub_tool_libcbase.h | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) 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 -- 2.47.2