From eff4d74743a577fe35736b3dd1a3a90404a1e25e Mon Sep 17 00:00:00 2001 From: Mooffie Date: Wed, 2 Nov 2016 22:03:57 +0200 Subject: [PATCH] (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 --- lib/search/hex.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/search/hex.c b/lib/search/hex.c index c82d50634..8b5470e61 100644 --- a/lib/search/hex.c +++ b/lib/search/hex.c @@ -78,11 +78,6 @@ mc_search__hex_translate_to_regex (const GString * astr, mc_search_hex_parse_err while (g_ascii_isspace (str[loop])) loop++; } - else if (str[loop] == '0' && (str[loop + 1] == 'x' || str[loop + 1] == 'X')) - { - /* Skip 0x prefixes. */ - loop += 2; - } /* cppcheck-suppress invalidscanf */ else if (sscanf (str + loop, "%x%n", &val, &ptr) == 1) {