From 96769486e20fd5f1142cae0db2cbacef31dc75e9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 17 Jun 2023 21:02:37 +0200 Subject: shell: move varcmp() to shell_common.h and use it in hush function old new delta unset_local_var - 112 +112 findvar 31 35 +4 set_vars_and_save_old 144 141 -3 helper_export_local 235 230 -5 set_local_var 425 416 -9 handle_changed_special_names 38 27 -11 builtin_unset 154 141 -13 builtin_getopts 404 391 -13 get_local_var_value 281 260 -21 get_ptr_to_local_var 71 45 -26 unset_local_var_len 139 - -139 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/8 up/down: 116/-240) Total: -124 bytes Signed-off-by: Denys Vlasenko --- shell/ash.c | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index dde36dd..96d2433 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2260,30 +2260,6 @@ getoptsreset(const char *value) #endif /* - * Compares two strings up to the first = or '\0'. The first - * string must be terminated by '='; the second may be terminated by - * either '=' or '\0'. - */ -static int -varcmp(const char *p, const char *q) -{ - int c, d; - - while ((c = *p) == (d = *q)) { - if (c == '\0' || c == '=') - goto out; - p++; - q++; - } - if (c == '=') - c = '\0'; - if (d == '=') - d = '\0'; - out: - return c - d; -} - -/* * Find the appropriate entry in the hash table from the name. */ static struct var ** -- cgit v1.1