Module Name: src
Committed By: kre
Date: Mon Oct 21 15:56:44 UTC 2024
Modified Files:
src/bin/sh: var.c
Log Message:
If searching for a variable with no name, bail out faster,
that can never succeed. NFCI.
To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/bin/sh/var.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/var.c
diff -u src/bin/sh/var.c:1.86 src/bin/sh/var.c:1.87
--- src/bin/sh/var.c:1.86 Mon Oct 14 08:15:43 2024
+++ src/bin/sh/var.c Mon Oct 21 15:56:44 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.86 2024/10/14 08:15:43 kre Exp $ */
+/* $NetBSD: var.c,v 1.87 2024/10/21 15:56:44 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: var.c,v 1.86 2024/10/14 08:15:43 kre Exp $");
+__RCSID("$NetBSD: var.c,v 1.87 2024/10/21 15:56:44 kre Exp $");
#endif
#endif /* not lint */
@@ -1356,6 +1356,9 @@ find_var(const char *name, struct var **
if (lenp)
*lenp = len;
+ if (len == 0)
+ return NULL;
+
vpp = &vartab[hashval % VTABSIZE];
if (vppp)
*vppp = vpp;