summaryrefslogtreecommitdiffstats
path: root/maps.c
diff options
context:
space:
mode:
authorJes Sorensen <jsorensen@fb.com>2017-04-21 18:11:21 +0200
committerJes Sorensen <jsorensen@fb.com>2017-04-21 18:11:21 +0200
commit4a4379b054a72b3c4abd93dd6e1283d6aa992ee2 (patch)
tree69dc18ab29a82e37b0989f75caef105f48c2fa0a /maps.c
parentmaps: Remove incorrect comment about strcmp() (diff)
downloadmdadm-4a4379b054a72b3c4abd93dd6e1283d6aa992ee2.tar.xz
mdadm-4a4379b054a72b3c4abd93dd6e1283d6aa992ee2.zip
maps: Simplify implementation of map_name()
Reported-By: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to '')
-rw-r--r--maps.c5
1 files changed, 1 insertions, 4 deletions
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;
}