Simplify the get_type() function.
Submitted by: bde Discussed with: bde, jhb and pfg MFC after: 2 weeks.
This commit is contained in:
parent
ec69bc9d6c
commit
323061173b
@ -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");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user