Commit 4ad22cde authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Removed function tableInqParNamePtr().

parent aed9becd
......@@ -826,27 +826,6 @@ int tableInqParName(int tableID, int code, char *varname)
}
const char *tableInqParNamePtr(int tableID, int code)
{
const char *name = NULL;
if ( tableID != CDI_UNDEFID )
{
int npars = parTable[tableID].npars;
for ( int item = 0; item < npars; item++ )
{
if ( parTable[tableID].pars[item].id == code )
{
name = parTable[tableID].pars[item].name;
break;
}
}
}
return name;
}
int tableInqParLongname(int tableID, int code, char *longname)
{
if ( ((tableID >= 0) & (tableID < MAX_TABLE)) | (tableID == CDI_UNDEFID) ) { } else
......
......@@ -22,8 +22,6 @@ param_type;
static void tableLink(int tableID, const param_type *pars, int npars);
int tableDef(int modelID, int tablegribID, const char *tablename);
const char *tableInqParNamePtr(int tableID, int parID);
#endif
/*
* Local Variables:
......
......@@ -541,24 +541,29 @@ char* vlistCopyVarName(int vlistId, int varId)
vlistCheckVarID(__func__, vlistId, varId);
//If a name is set in the variable description, use that.
const char* name = vlistptr->vars[varId].name;
if(name) return strdup(name);
{
const char* name = vlistptr->vars[varId].name;
if (name) return strdup(name);
}
//Otherwise we check if we should use the table of parameter descriptions.
int param = vlistptr->vars[varId].param;
int discipline, category, number;
cdiDecodeParam(param, &number, &category, &discipline);
char *result = NULL;
if(discipline == 255)
if (discipline == 255)
{
int tableId = vlistptr->vars[varId].tableID;
if(( name = tableInqParNamePtr(tableId, number) ))
char name[CDI_MAX_NAME]; name[0] = 0;
tableInqParName(tableId, number, name);
if ( name[0] )
result = strdup(name);
{
//No luck, fall back to outputting a name of the format "var<num>".
result = (char *) Malloc(3 + 3 * sizeof (int) * CHAR_BIT / 8 + 2);
sprintf(result, "var%d", number);
}
else
{
//No luck, fall back to outputting a name of the format "var<num>".
result = (char *) Malloc(3 + 3 * sizeof (int) * CHAR_BIT / 8 + 2);
sprintf(result, "var%d", number);
}
}
else
{
......
Markdown is supported
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