MCPcopy Create free account
hub / github.com/coreutils/coreutils / eval3

Function eval3

src/expr.c:810–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

808/* Handle +, - operators. */
809
810static VALUE *
811eval3 (bool evaluate)
812{
813#ifdef EVAL_TRACE
814 trace ("eval3");
815#endif
816 VALUE *l = eval4 (evaluate);
817 while (true)
818 {
819 enum { plus, minus } fxn;
820
821 if (nextarg ("+"))
822 fxn = plus;
823 else if (nextarg ("-"))
824 fxn = minus;
825 else
826 return l;
827 VALUE *r = eval4 (evaluate);
828 if (evaluate)
829 {
830 if (!toarith (l) || !toarith (r))
831 error (EXPR_INVALID, 0, _("non-integer argument"));
832 (fxn == plus ? mpz_add : mpz_sub) (l->u.i, l->u.i, r->u.i);
833 }
834 freev (r);
835 }
836}
837
838/* Handle comparisons. */
839

Callers 1

eval2Function · 0.85

Calls 5

traceFunction · 0.85
eval4Function · 0.85
nextargFunction · 0.85
toarithFunction · 0.85
freevFunction · 0.85

Tested by

no test coverage detected