Commit 183023f7 authored by Uwe Schulzweida's avatar Uwe Schulzweida

param_search_name: forward search.

parent 5696eff4
......@@ -1657,30 +1657,26 @@ int exNode(nodeType *p, parseParamType *parse_arg)
static int
param_search_name(const int nparam, const paramType *params, const char *name)
{
int varID = -1;
// for (varID = 0; varID < nparam; ++varID)
for (varID = nparam - 1; varID >= 0; --varID)
// for (int varID = nparam - 1; varID >= 0; --varID)
for (int varID = 0; varID < nparam; ++varID)
{
if (cdo_cmpstr(params[varID].name, name)) break;
if (cdo_cmpstr(params[varID].name, name)) return varID;
}
return varID;
return -1;
}
static int
param_search_name_size(const int nparam, const paramType *params, const char *name, size_t ngp, size_t nlev)
{
int varID = -1;
//for (varID = 0; varID < nparam; ++varID)
for (varID = nparam - 1; varID >= 0; --varID)
// for (int varID = nparam - 1; varID >= 0; --varID)
for (int varID = 0; varID < nparam; ++varID)
{
if (ngp == params[varID].ngp && nlev == params[varID].nlev)
if (cdo_cmpstr(params[varID].name, name)) break;
if (cdo_cmpstr(params[varID].name, name)) return varID;
}
return varID;
return -1;
}
static void
......@@ -1860,9 +1856,9 @@ expr_run_type_var(nodeType *p, parseParamType *parse_arg)
if (varID == -1 && init)
{
const auto len = strlen(vnm);
const auto coord = vnm[len - 1];
if (len > 2 && vnm[len - 2] == '.')
{
const auto coord = vnm[len - 1];
if (coord == 'x' || coord == 'y' || coord == 'a' || coord == 'w')
{
varID = expr_run_type_var_grid(vnm, coord, parse_arg);
......
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