diff --git a/src/expr.c b/src/expr.c index a08f0e03..fa2aa39a 100644 --- a/src/expr.c +++ b/src/expr.c @@ -426,7 +426,7 @@ get_var(expr_node *node, Value *ans, int *nonconst) return E_NOSUCH_VAR; } v->used_since_set = 1; - if (v->nonconstant) { + if (!v->is_constant) { nonconst_debug(*nonconst, tr("Global variable `%s' makes expression non-constant"), str); *nonconst = 1; } diff --git a/src/types.h b/src/types.h index 42d0ca65..590d8c3c 100644 --- a/src/types.h +++ b/src/types.h @@ -105,7 +105,7 @@ typedef struct var { struct hash_link link; char name[VAR_NAME_LEN+1]; char preserve; - char nonconstant; + char is_constant; char used_since_set; Value v; } Var; diff --git a/src/var.c b/src/var.c index 7c851041..42b77b09 100644 --- a/src/var.c +++ b/src/var.c @@ -599,7 +599,7 @@ int SetVar(char const *str, Value const *val, int nonconst_expr) DestroyValue(v->v); v->v = *val; - v->nonconstant = nonconst_expr; + v->is_constant = ! nonconst_expr; v->used_since_set = 0; return OK; } @@ -653,8 +653,8 @@ int DoSet (Parser *p) } var = FindVar(DBufValue(&buf), 0); if (var) { - nonconst_debug(var->nonconstant, tr("Potential variable assignment considered non-constant because of context")); - var->nonconstant = 1; + nonconst_debug(!var->is_constant, tr("Potential variable assignment considered non-constant because of context")); + var->is_constant = 0; } DBufFree(&buf); return OK; @@ -787,7 +787,7 @@ int DoDump(ParsePtr p) fprintf(ErrFp, "%s ", v->name); PrintValue(&(v->v), ErrFp); if (dump_constness) { - if (!v->nonconstant) { + if (v->is_constant) { fprintf(ErrFp, " "); } } @@ -822,7 +822,7 @@ void DumpVarTable(int dump_constness) fprintf(ErrFp, "%s ", v->name); PrintValue(&(v->v), ErrFp); if (dump_constness) { - if (!v->nonconstant) { + if (v->is_constant) { fprintf(ErrFp, " "); } }