Commit c643ed76 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

proc_parse: Speedup VMA range parsing

In /proc/<pid>/smaps/ output we may omit testing
for capital hex letters, since we know the format
kernel provides.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c8d5f1a2
...@@ -69,19 +69,24 @@ int parse_cpuinfo_features(int (*handler)(char *tok)) ...@@ -69,19 +69,24 @@ int parse_cpuinfo_features(int (*handler)(char *tok))
/* check the @line starts with "%lx-%lx" format */ /* check the @line starts with "%lx-%lx" format */
static bool is_vma_range_fmt(char *line) 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++; line++;
if (*line++ != '-') if (*line++ != '-')
return false; return false;
while (*line && is_hex_digit(*line)) while (*line && ____is_vma_addr_char(*line))
line++; line++;
if (*line++ != ' ') if (*line++ != ' ')
return false; return false;
return true; return true;
#undef ____is_vma_addr_char
} }
static int parse_vmflags(char *buf, struct vma_area *vma_area) static int parse_vmflags(char *buf, struct vma_area *vma_area)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment