summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-02-14 07:22:16 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-02-14 07:22:16 -0800
commitee7866ae60fe4357bbcd453dbfdf5a90528dda7b (patch)
treeaa53042bc2d2076fd8d32d3c80400cd977a483c1 /parser.c
parent8c25a6210a1fc44901fd6ebf7fb3f63c0ca5eec0 (diff)
downloadtxr-ee7866ae60fe4357bbcd453dbfdf5a90528dda7b.tar.gz
txr-ee7866ae60fe4357bbcd453dbfdf5a90528dda7b.tar.bz2
txr-ee7866ae60fe4357bbcd453dbfdf5a90528dda7b.zip
gethash_c: review uses and improve or replace.
* eval.c (env_fbind, env_vbind, reg_symacro): Use gethash_l instead of gethash_c to eliminate repeated cdr operations on the same cell. * hash.c (sethash): Since new_p is never used, eliminated it and use nulloc. (group_reduce): Use gethash_l instead of gethash_c. * lib.c (obj_init): Replace rplacd(gethash_c(...)) pattern whose return value is not used with with sethash. We lose some diagnosability here since sethash doesn't take a "self" argument. (obj_print_impl, obj_hash_merge): Use gethash_l instead of gethash_c. * parser.y (ensure_parser, parser_circ_def, get_visible_syms, rlset): Use gethash_l instead of gethash_c.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/parser.c b/parser.c
index 6ce469ec..1478aeaf 100644
--- a/parser.c
+++ b/parser.c
@@ -175,11 +175,11 @@ static parser_t *get_parser_impl(val self, val parser)
static val ensure_parser(val stream)
{
- val cell = gethash_c(lit("internal error"), stream_parser_hash, stream, nulloc);
- val pars = cdr(cell);
+ loc pcdr = gethash_l(lit("internal error"), stream_parser_hash, stream, nulloc);
+ val pars = deref(pcdr);
if (pars)
return pars;
- return sys_rplacd(cell, parser(stream, one));
+ return set(pcdr, parser(stream, one));
}
static void pushback_token(parser_t *p, struct yy_token *tok)
@@ -390,12 +390,12 @@ void parser_circ_def(parser_t *p, val num, val expr)
{
val new_p = nil;
- val cell = gethash_c(lit("parser"), p->circ_ref_hash, num, mkcloc(new_p));
+ loc pcdr = gethash_l(lit("parser"), p->circ_ref_hash, num, mkcloc(new_p));
- if (!new_p && cdr(cell) != unique_s)
+ if (!new_p && deref(pcdr) != unique_s)
yyerrorf(p->scanner, lit("duplicate #~s= def"), num, nao);
- rplacd(cell, expr);
+ set(pcdr, expr);
}
}
@@ -743,9 +743,9 @@ static val get_visible_syms(val package, int include_fallback)
val fcell;
val new_p;
while ((fcell = hash_next(hiter))) {
- val scell = gethash_c(lit("listener"), symhash, car(fcell), mkcloc(new_p));
+ loc pcdr = gethash_l(lit("listener"), symhash, car(fcell), mkcloc(new_p));
if (new_p)
- rplacd(scell, cdr(fcell));
+ set(pcdr, cdr(fcell));
}
}
return hash_values(symhash);