summaryrefslogtreecommitdiffstats
path: root/src/interp.c
diff options
context:
space:
mode:
authorandmarti1424 <andmarti@gmail.com>2017-03-17 19:23:41 -0300
committerandmarti1424 <andmarti@gmail.com>2017-03-17 19:23:41 -0300
commitc3fb4727cbb783c45a4391e5ce5e046c24c8d821 (patch)
treee72415266d8eee8f276f82251a867875cdcafd13 /src/interp.c
parent298c1423e39d5218ae62b58743a3e9aca12198d1 (diff)
removed double eval
Diffstat (limited to 'src/interp.c')
-rw-r--r--src/interp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/interp.c b/src/interp.c
index dca521a..3757fd9 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -1896,6 +1896,7 @@ void unlock_cells(struct ent * v1, struct ent * v2) {
/* set the numeric part of a cell */
void let(struct ent * v, struct enode * e) {
+
if (locked_cell(v->row, v->col)) return;
#ifdef UNDO
@@ -1916,6 +1917,7 @@ void let(struct ent * v, struct enode * e) {
double val;
+ short already_eval = FALSE;
unsigned isconstant = constant(e);
if (v->row == currow && v->col == curcol)
cellassign = 1;
@@ -1931,6 +1933,7 @@ void let(struct ent * v, struct enode * e) {
} else {
cellerror = CELLOK;
val = eval(v, e); // JUST NUMERIC VALUE
+ already_eval = TRUE;
}
if (v->cellerror != cellerror) {
v->flags |= is_changed;
@@ -1960,7 +1963,7 @@ void let(struct ent * v, struct enode * e) {
v->expr = (struct enode *) 0;
}
efree(e);
- } else if (! exprerr) {
+ } else if (! exprerr && ! already_eval) {
efree(v->expr);
v->expr = e;
@@ -2014,6 +2017,8 @@ void slet(struct ent * v, struct enode * se, int flushdir) {
char * p;
if (v->row == currow && v->col == curcol) cellassign = 1;
exprerr = 0;
+ short already_eval = FALSE;
+
(void) signal(SIGFPE, eval_fpe);
if (setjmp(fpe_save)) {
sc_error ("Floating point exception in cell %s", v_name(v->row, v->col));
@@ -2040,7 +2045,7 @@ void slet(struct ent * v, struct enode * se, int flushdir) {
v->expr = (struct enode *) 0;
v->flags &= ~is_strexpr;
}
- } else {
+ } else if ( ! already_eval ) {
if (p) free(p); // ADDED for 2267 leak!
efree(v->expr);
@@ -2049,7 +2054,7 @@ void slet(struct ent * v, struct enode * se, int flushdir) {
p = seval(v, se); // ADDED - here we store the cell dependences in a graph
if (p) scxfree(p); // ADDED
- v->flags |= (is_changed|is_strexpr);
+ v->flags |= (is_changed | is_strexpr);
if (flushdir < 0) v->flags |= is_leftflush;
if (flushdir == 0)