← Commit list

371fe9f71

Ron Yorston
Ron Yorston
2024-07-14
SUCCESS Duration: 156s

Subject

ash: move hashvar() calls into findvar()

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+8 -9
@@ -2327,9 +2327,11 @@ initvar(void)
}
static struct var **
-findvar(struct var **vpp, const char *name)
+findvar(const char *name)
{
- for (; *vpp; vpp = &(*vpp)->next) {
+ struct var **vpp;
+
+ for (vpp = hashvar(name); *vpp; vpp = &(*vpp)->next) {
if (varcmp((*vpp)->var_text, name) == 0) {
break;
}
@@ -2345,7 +2347,7 @@ lookupvar(const char *name)
{
struct var *v;
- v = *findvar(hashvar(name), name);
+ v = *findvar(name);
if (v) {
#if ENABLE_ASH_RANDOM_SUPPORT || BASH_EPOCH_VARS
/*
@@ -2412,9 +2414,8 @@ setvareq(char *s, int flags)
{
struct var *vp, **vpp;
- vpp = hashvar(s);
flags |= (VEXPORT & (((unsigned) (1 - aflag)) - 1));
- vpp = findvar(vpp, s);
+ vpp = findvar(s);
vp = *vpp;
if (vp) {
if ((vp->flags & (VREADONLY|VDYNAMIC)) == VREADONLY) {
@@ -9978,7 +9979,6 @@ static void
mklocal(char *name, int flags)
{
struct localvar *lvp;
- struct var **vpp;
struct var *vp;
char *eq = strchr(name, '=');
@@ -10007,8 +10007,7 @@ mklocal(char *name, int flags)
lvp->text = memcpy(p, optlist, sizeof(optlist));
vp = NULL;
} else {
- vpp = hashvar(name);
- vp = *findvar(vpp, name);
+ vp = *findvar(name);
if (vp == NULL) {
/* variable did not exist yet */
if (eq)
@@ -14156,7 +14155,7 @@ exportcmd(int argc UNUSED_PARAM, char **argv)
if (p != NULL) {
p++;
} else {
- vp = *findvar(hashvar(name), name);
+ vp = *findvar(name);
if (vp) {
vp->flags = ((vp->flags | flag) & flag_off);
continue;