From c643ed76e70edc712a03f723faf1ac99a88e50e4 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Mon, 3 Feb 2014 17:24:00 +0400 Subject: [PATCH] proc_parse: Speedup VMA range parsing In /proc//smaps/ output we may omit testing for capital hex letters, since we know the format kernel provides. Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- proc_parse.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/proc_parse.c b/proc_parse.c index 254fced63..4ca80bde4 100644 --- a/proc_parse.c +++ b/proc_parse.c @@ -69,19 +69,24 @@ int parse_cpuinfo_features(int (*handler)(char *tok)) /* check the @line starts with "%lx-%lx" format */ static bool is_vma_range_fmt(char *line) { - while (*line && is_hex_digit(*line)) +#define ____is_vma_addr_char(__c) \ + (((__c) <= '9' && (__c) >= '0') || \ + ((__c) <= 'f' && (__c) >= 'a')) + + while (*line && ____is_vma_addr_char(*line)) line++; if (*line++ != '-') return false; - while (*line && is_hex_digit(*line)) + while (*line && ____is_vma_addr_char(*line)) line++; if (*line++ != ' ') return false; return true; +#undef ____is_vma_addr_char } static int parse_vmflags(char *buf, struct vma_area *vma_area)