about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/params.c27
-rw-r--r--Src/subst.c1
2 files changed, 12 insertions, 16 deletions
diff --git a/Src/params.c b/Src/params.c
index acbe448a2..28a8f1e85 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1998,17 +1998,16 @@ setiparam(char *s, zlong val)
     if (!(v = getvalue(&vbuf, &s, 1))) {
 	if ((ss = strchr(s, '[')))
 	    *ss = '\0';
-	pm = createparam(t, ss ? PM_ARRAY : PM_INTEGER);
+	if (!(pm = createparam(t, ss ? PM_ARRAY : PM_INTEGER)))
+	    pm = (Param) paramtab->getnode(paramtab, t);
 	DPUTS(!pm, "BUG: parameter not created");
 	if (ss) {
 	    *ss = '[';
-	    v = getvalue(&vbuf, &t, 1);
-	    DPUTS(!v, "BUG: value not found for new parameter");
 	} else {
-	    pm->u.val = val;
-	    unqueue_signals();
-	    return pm;
+	    pm->ct = outputradix;
 	}
+	v = getvalue(&vbuf, &t, 1);
+	DPUTS(!v, "BUG: value not found for new parameter");
     }
     mnval.type = MN_INTEGER;
     mnval.u.l = val;
@@ -2042,20 +2041,16 @@ setnparam(char *s, mnumber val)
 	    *ss = '\0';
 	pm = createparam(t, ss ? PM_ARRAY :
 			 (val.type & MN_INTEGER) ? PM_INTEGER : PM_FFLOAT);
+	if (!pm)
+	    pm = (Param) paramtab->getnode(paramtab, t);
 	DPUTS(!pm, "BUG: parameter not created");
 	if (ss) {
 	    *ss = '[';
-	    v = getvalue(&vbuf, &t, 1);
-	    DPUTS(!v, "BUG: value not found for new parameter");
-	} else {
-	    if (val.type & MN_INTEGER) {
-		pm->ct = outputradix;
-		pm->u.val = val.u.l;
-	    } else
-		pm->u.dval = val.u.d;
-	    unqueue_signals();
-	    return pm;
+	} else if (val.type & MN_INTEGER) {
+	    pm->ct = outputradix;
 	}
+	v = getvalue(&vbuf, &t, 1);
+	DPUTS(!v, "BUG: value not found for new parameter");
     }
     setnumvalue(v, val);
     unqueue_signals();
diff --git a/Src/subst.c b/Src/subst.c
index 24103b3da..25eda1cee 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1149,6 +1149,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		isarr = 0;
 	    }
 	    pm = createparam(nulstring, isarr ? PM_ARRAY : PM_SCALAR);
+	    DPUTS(!pm, "BUG: parameter not created");
 	    if (isarr)
 		pm->u.arr = aval;
 	    else