maps: fix null termination in code regions detection

The binary name used to detect the regions belong to the same ELF
binary should better be null terminated just in case the strcmp is
used instead of strncmp.
maps: introduce parse_region() to reduce line length

Functionality is still the same but we can reduce the line length
and improve readability by moving the region parsing into a
separate function.