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

param_search_name: forward search.

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