iris

small scheme interpreter
git clone git://git.2f30.org/iris.git
Log | Files | Refs | LICENSE

commit 00792adc339c684de30192de4ce3c45d3231766d
parent 177e080cb456b170a1609e5c32e0487f64bef209
Author: sin <sin@2f30.org>
Date:   Mon May 19 12:41:15 +0100

Only replace symbols in the top environment

Diffstat:
sym.c | 13+++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/sym.c b/sym.c @@ -24,17 +24,14 @@ static struct env *topenv; struct object * addsym(char *s, struct object *o) { - struct env *e; struct symentry *se; size_t i; - for (e = topenv; e >= &env[0]; e--) { - for (i = 0; i < e->symtab.sz; i++) { - se = &e->symtab.se[i]; - if (strcmp(se->s, s) == 0) { - se->o = o; - return o; - } + for (i = 0; i < topenv->symtab.sz; i++) { + se = &topenv->symtab.se[i]; + if (strcmp(se->s, s) == 0) { + se->o = o; + return o; } } if (topenv->symtab.sz + 1 > LEN(topenv->symtab.se))