(mc_search__hex_translate_to_regex): remove explicit handling of 0x prefixes.

scanf("%x") knows to eat up this prefix[1][2], so we don't need to do this
ourselves.

[1] K&R's "The C Programming Language" documents "%x" as "hexadecimal
    integer (with or without leading 0x or 0X)"
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Mooffie 2016-11-02 22:03:57 +02:00 committed by Andrew Borodin
parent f96b11cf66
commit eff4d74743

View File

@ -78,11 +78,6 @@ mc_search__hex_translate_to_regex (const GString * astr, mc_search_hex_parse_err
while (g_ascii_isspace (str[loop])) while (g_ascii_isspace (str[loop]))
loop++; loop++;
} }
else if (str[loop] == '0' && (str[loop + 1] == 'x' || str[loop + 1] == 'X'))
{
/* Skip 0x prefixes. */
loop += 2;
}
/* cppcheck-suppress invalidscanf */ /* cppcheck-suppress invalidscanf */
else if (sscanf (str + loop, "%x%n", &val, &ptr) == 1) else if (sscanf (str + loop, "%x%n", &val, &ptr) == 1)
{ {