Commit 1f70cc85 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Simplify control flow in tableInqParUnits.

parent 92a96908
......@@ -931,30 +931,25 @@ int tableInqParLongname(int tableID, int code, char *longname)
int tableInqParUnits(int tableID, int code, char *units)
{
int item, npars;
int err = 0;
npars = parTable[tableID].npars;
if ( ((tableID >= 0) & (tableID < MAX_TABLE)) | (tableID == UNDEFID) ) { } else
Error("Invalid table ID %d", tableID);
if ( tableID == UNDEFID )
{
err = 1;
}
else
int err = 1;
if ( tableID != UNDEFID )
{
for ( item = 0; item < npars; item++ )
int npars = parTable[tableID].npars;
for ( int item = 0; item < npars; item++ )
{
if ( parTable[tableID].pars[item].id == code )
{
if ( parTable[tableID].pars[item].units )
strcpy(units, parTable[tableID].pars[item].units);
err = 0;
break;
}
}
if ( item == npars ) err = 1;
}
return (err);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment