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:
parent
966188e959
commit
4a4379b054
5
maps.c
5
maps.c
|
@ -165,11 +165,8 @@ char *map_num(mapping_t *map, int num)
|
||||||
|
|
||||||
int map_name(mapping_t *map, char *name)
|
int map_name(mapping_t *map, char *name)
|
||||||
{
|
{
|
||||||
while (map->name) {
|
while (map->name && strcmp(map->name, name) != 0)
|
||||||
if (strcmp(map->name, name)==0)
|
|
||||||
return map->num;
|
|
||||||
map++;
|
map++;
|
||||||
}
|
|
||||||
|
|
||||||
return map->num;
|
return map->num;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue