Commit 0872d0aa authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

varscan::cmpparam: apply patch from Thomas Jahns

parent 7ea060d9
......@@ -3,6 +3,10 @@
* Version 1.6.4 released
* using CGRIBEX library version 1.6.4
2014-04-10 Uwe Schulzweida
* varscan::cmpparam: apply patch from Thomas Jahns
2014-03-24 Uwe Schulzweida
* configure --with-netCDF: set default=no
......
......@@ -422,31 +422,15 @@ param_t;
static
int cmpparam(const void* s1, const void* s2)
{
int cmp = 0;
const param_t* x = s1;
const param_t* y = s2;
if ( x->param > y->param ) cmp = 1;
else if ( x->param < y->param ) cmp = -1;
int cmp = (( x->param > y->param ) - ( x->param < y->param )) * 2
+ ( x->ltype > y->ltype ) - ( x->ltype < y->ltype );
return (cmp);
}
static
int cmpltype(const void* s1, const void* s2)
{
int cmp = 0;
const param_t* x = s1;
const param_t* y = s2;
if ( x->ltype > y->ltype ) cmp = 1;
else if ( x->ltype < y->ltype ) cmp = -1;
return (cmp);
}
void cdi_generate_vars(stream_t *streamptr)
{
int varID, gridID, zaxisID, levelID;
......@@ -486,7 +470,6 @@ void cdi_generate_vars(stream_t *streamptr)
varInfo[varid]->param = vartable[varid].param;
varInfo[varid]->ltype = vartable[varid].ltype;
}
qsort(varInfo[0], nvars, sizeof(param_t), cmpltype);
qsort(varInfo[0], nvars, sizeof(param_t), cmpparam);
for ( varid = 0; varid < nvars; varid++ )
{
......
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