maps: Simplify implementation of map_name()

Reported-By: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Jes Sorensen 2017-04-21 12:11:21 -04:00
parent 966188e959
commit 4a4379b054
1 changed files with 1 additions and 4 deletions

5
maps.c
View File

@ -165,11 +165,8 @@ char *map_num(mapping_t *map, int num)
int map_name(mapping_t *map, char *name)
{
while (map->name) {
if (strcmp(map->name, name)==0)
return map->num;
while (map->name && strcmp(map->name, name) != 0)
map++;
}
return map->num;
}