From: Jes Sorensen Date: Fri, 21 Apr 2017 16:11:21 +0000 (-0400) Subject: maps: Simplify implementation of map_name() X-Git-Tag: mdadm-4.1-rc1~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a4379b054a72b3c4abd93dd6e1283d6aa992ee2;p=thirdparty%2Fmdadm.git maps: Simplify implementation of map_name() Reported-By: NeilBrown Signed-off-by: Jes Sorensen --- diff --git a/maps.c b/maps.c index 81f29c41..bb28ba65 100644 --- a/maps.c +++ b/maps.c @@ -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; }