tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 5271b4a8b8969b33404dff0bf2f32a6abe5b900c
parent 48631876318cdf47cdd9f1efd90e48a7524a3062
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Thu, 12 Sep 2019 15:38:57 -0700

Dynamically allocate new symbols like strings are

Diffstat:
tisp.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tisp.c b/tisp.c @@ -394,7 +394,8 @@ mk_sym(Env env, char *s) return ret; ret = emalloc(sizeof(struct Val)); ret->t = SYMBOL; - ret->v.s = s; + ret->v.s = emalloc((strlen(s)+1) * sizeof(char)); + strcpy(ret->v.s, s); hash_add(env->syms, s, ret); return ret; }