Skip to content
Snippets Groups Projects
Commit 1f70cc85 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Simplify control flow in tableInqParUnits.

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