diff options
author | araujo <araujo@FreeBSD.org> | 2016-04-21 06:11:24 +0000 |
---|---|---|
committer | araujo <araujo@FreeBSD.org> | 2016-04-21 06:11:24 +0000 |
commit | 323061173b5c133390f418dc4ab9b709273474c8 (patch) | |
tree | 3c7d6612b907a58f52f91ea624a2d8a7288c9022 /sbin | |
parent | ec69bc9d6cecca3751bf3a0e75de75d11355712d (diff) | |
download | FreeBSD-src-323061173b5c133390f418dc4ab9b709273474c8.zip FreeBSD-src-323061173b5c133390f418dc4ab9b709273474c8.tar.gz |
Simplify the get_type() function.
Submitted by: bde
Discussed with: bde, jhb and pfg
MFC after: 2 weeks.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/fdisk_pc98/fdisk.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sbin/fdisk_pc98/fdisk.c b/sbin/fdisk_pc98/fdisk.c index 7c1a64b..e8d54d5 100644 --- a/sbin/fdisk_pc98/fdisk.c +++ b/sbin/fdisk_pc98/fdisk.c @@ -854,17 +854,11 @@ string(const char *str, char **ans) static const char * get_type(int type) { - int numentries = nitems(part_types); - int counter = 0; - struct part_type *ptr = part_types; + size_t i; - - while(counter < numentries) { - if(ptr->type == (type & 0x7f)) - return(ptr->name); - ptr++; - counter++; - } + for (i = 0; i < nitems(part_types); i++) + if(part_types[i].type == (type & 0x7f)) + return(part_types[i].name); return("unknown"); } |