From 37ed0c099066c5c37f3ffc5e3adda5702fdbd469 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 14 Aug 2022 14:45:05 -0700 Subject: [PATCH] expr expush: remove unused string path As of the previous commit, this is unused. --- lib/expr/exgram.h | 33 ++++++++++++++------------------- lib/expr/expr.h | 2 +- lib/expr/extoken.c | 2 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/lib/expr/exgram.h b/lib/expr/exgram.h index 428878524..6c34f4015 100644 --- a/lib/expr/exgram.h +++ b/lib/expr/exgram.h @@ -814,9 +814,7 @@ preprint(Exnode_t* args) * push a new input stream and program */ -int -expush(Expr_t* p, const char* name, int line, const char* sp, Sfio_t* fp) -{ +int expush(Expr_t *p, const char *name, int line, Sfio_t *fp) { Exinput_t* in; char* s; char buf[PATH_MAX]; @@ -828,25 +826,22 @@ expush(Expr_t* p, const char* name, int line, const char* sp, Sfio_t* fp) } if (!p->input) p->input = &expr.null; - if (!(in->bp = in->sp = (char*)sp)) + in->bp = in->sp = NULL; + if ((in->fp = fp)) + in->close = 0; + else if (name) { - if ((in->fp = fp)) - in->close = 0; - else if (name) + if (!(s = pathfind(name, p->disc->lib, p->disc->type, buf, sizeof(buf))) || !(in->fp = sfopen(s, "r"))) { - if (!(s = pathfind(name, p->disc->lib, p->disc->type, buf, sizeof(buf))) || !(in->fp = sfopen(s, "r"))) - { - exerror("%s: file not found", name); - in->bp = in->sp = ""; - } - else - { - name = vmstrdup(p->vm, s); - in->close = 1; - } + exerror("%s: file not found", name); + in->bp = in->sp = ""; + } + else + { + name = vmstrdup(p->vm, s); + in->close = 1; } } - else in->fp = 0; if (!(in->next = p->input)->next) { p->errors = 0; @@ -938,7 +933,7 @@ int excomp(Expr_t *p, const char *name, int line, Sfio_t *fp) { if (!p->input) return -1; } - else if (expush(p, name, line, NULL, fp)) + else if (expush(p, name, line, fp)) return -1; else p->input->unit = line >= 0; diff --git a/lib/expr/expr.h b/lib/expr/expr.h index 047c5cdf7..1ce7b0fc7 100644 --- a/lib/expr/expr.h +++ b/lib/expr/expr.h @@ -261,7 +261,7 @@ extern Exnode_t* exnewnode(Expr_t*, int, int, int, Exnode_t*, Exnode_t*); extern char* exnospace(void); extern Expr_t* exopen(Exdisc_t*); extern int expop(Expr_t*); -extern int expush(Expr_t*, const char*, int, const char*, Sfio_t*); +extern int expush(Expr_t*, const char*, int, Sfio_t*); extern char* exstash(Sfio_t*, Vmalloc_t*); extern int extoken_fn(Expr_t*); extern char* exstring(Expr_t *, char *); diff --git a/lib/expr/extoken.c b/lib/expr/extoken.c index 7d28466ed..863f81627 100644 --- a/lib/expr/extoken.c +++ b/lib/expr/extoken.c @@ -482,7 +482,7 @@ extoken_fn(Expr_t* ex) { if (extoken_fn(ex) != STRING) exerror("#%s: string argument expected", s); - else if (!expush(ex, ex_lval.string, 1, NULL, NULL)) + else if (!expush(ex, ex_lval.string, 1, NULL)) { setcontext(ex); goto again; -- 2.40.0