commit 00792adc339c684de30192de4ce3c45d3231766d parent 177e080cb456b170a1609e5c32e0487f64bef209 Author: sin <sin@2f30.org> Date: Mon, 19 May 2014 12:41:15 +0100 Only replace symbols in the top environment Diffstat:
M | 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))