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

Simplify control flow in tableInqParLongname.

parent d052c560
No related branches found
No related tags found
No related merge requests found
...@@ -905,30 +905,24 @@ const char *tableInqParUnitsPtr(int tableID, int code) ...@@ -905,30 +905,24 @@ const char *tableInqParUnitsPtr(int tableID, int code)
int tableInqParLongname(int tableID, int code, char *longname) int tableInqParLongname(int tableID, int code, char *longname)
{ {
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].longname ) if ( parTable[tableID].pars[item].longname )
strcpy(longname, parTable[tableID].pars[item].longname); strcpy(longname, parTable[tableID].pars[item].longname);
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