Commit 2ce71fa9 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Simplify control flow in tableInqParName.

parent edebd854
......@@ -825,27 +825,21 @@ int tableInqParCode(int tableID, char *varname, int *code)
int tableInqParName(int tableID, int code, char *varname)
{
int item, npars;
int err = 0;
npars = parTable[tableID].npars;
int err = 1;
if ( tableID == UNDEFID )
{
err = 1;
}
else
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].name )
strcpy(varname, parTable[tableID].pars[item].name); //FIXME: This may overrun the supplied buffer!
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