[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/22] envlist: Remove unused envlist_parse
From: |
Michael Tokarev |
Subject: |
[PULL 10/22] envlist: Remove unused envlist_parse |
Date: |
Fri, 20 Sep 2024 10:41:22 +0300 |
From: "Dr. David Alan Gilbert" <dave@treblig.org>
envlist_parse, envlist_parse_set, envlist_parse_unset were added
in 2009 but never used, see:
04a6dfebb6 ("linux-user: Add generic env variable handling")
Remove them.
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
include/qemu/envlist.h | 2 --
util/envlist.c | 69 ------------------------------------------
2 files changed, 71 deletions(-)
diff --git a/include/qemu/envlist.h b/include/qemu/envlist.h
index 6006dfae44..b2883f6659 100644
--- a/include/qemu/envlist.h
+++ b/include/qemu/envlist.h
@@ -7,8 +7,6 @@ envlist_t *envlist_create(void);
void envlist_free(envlist_t *);
int envlist_setenv(envlist_t *, const char *);
int envlist_unsetenv(envlist_t *, const char *);
-int envlist_parse_set(envlist_t *, const char *);
-int envlist_parse_unset(envlist_t *, const char *);
char **envlist_to_environ(const envlist_t *, size_t *);
#endif /* ENVLIST_H */
diff --git a/util/envlist.c b/util/envlist.c
index db937c0427..15fdbb109d 100644
--- a/util/envlist.c
+++ b/util/envlist.c
@@ -12,9 +12,6 @@ struct envlist {
size_t el_count; /* number of entries */
};
-static int envlist_parse(envlist_t *envlist,
- const char *env, int (*)(envlist_t *, const char *));
-
/*
* Allocates new envlist and returns pointer to it.
*/
@@ -51,72 +48,6 @@ envlist_free(envlist_t *envlist)
g_free(envlist);
}
-/*
- * Parses comma separated list of set/modify environment
- * variable entries and updates given enlist accordingly.
- *
- * For example:
- * envlist_parse(el, "HOME=foo,SHELL=/bin/sh");
- *
- * inserts/sets environment variables HOME and SHELL.
- *
- * Returns 0 on success, errno otherwise.
- */
-int
-envlist_parse_set(envlist_t *envlist, const char *env)
-{
- return (envlist_parse(envlist, env, &envlist_setenv));
-}
-
-/*
- * Parses comma separated list of unset environment variable
- * entries and removes given variables from given envlist.
- *
- * Returns 0 on success, errno otherwise.
- */
-int
-envlist_parse_unset(envlist_t *envlist, const char *env)
-{
- return (envlist_parse(envlist, env, &envlist_unsetenv));
-}
-
-/*
- * Parses comma separated list of set, modify or unset entries
- * and calls given callback for each entry.
- *
- * Returns 0 in case of success, errno otherwise.
- */
-static int
-envlist_parse(envlist_t *envlist, const char *env,
- int (*callback)(envlist_t *, const char *))
-{
- char *tmpenv, *envvar;
- char *envsave = NULL;
- int ret = 0;
- assert(callback != NULL);
-
- if ((envlist == NULL) || (env == NULL))
- return (EINVAL);
-
- tmpenv = g_strdup(env);
- envsave = tmpenv;
-
- do {
- envvar = strchr(tmpenv, ',');
- if (envvar != NULL) {
- *envvar = '\0';
- }
- if ((*callback)(envlist, tmpenv) != 0) {
- ret = errno;
- break;
- }
- tmpenv = envvar + 1;
- } while (envvar != NULL);
-
- g_free(envsave);
- return ret;
-}
-
/*
* Sets environment value to envlist in similar manner
* than putenv(3).
--
2.39.5
- [PULL 00/22] Trivial patches for 2024-09-20, Michael Tokarev, 2024/09/20
- [PULL 01/22] mark <zlib.h> with for-crc32 in a consistent manner, Michael Tokarev, 2024/09/20
- [PULL 03/22] linux-user/syscall.c: eliminate other explicit LFS usages, Michael Tokarev, 2024/09/20
- [PULL 02/22] linux-user/syscall.c: drop 64 suffix from flock64 &Co, Michael Tokarev, 2024/09/20
- [PULL 05/22] hw/mips/jazz: fix typo in in-built NIC alias, Michael Tokarev, 2024/09/20
- [PULL 04/22] ppc: fix incorrect spelling of PowerMac, Michael Tokarev, 2024/09/20
- [PULL 06/22] hw/loongarch/virt: Add description for virt machine type, Michael Tokarev, 2024/09/20
- [PULL 07/22] tests/unit: Really build pbkdf test on macOS, Michael Tokarev, 2024/09/20
- [PULL 08/22] hw/virtio/Kconfig: Include vhost-user-scmi only on arm targets, Michael Tokarev, 2024/09/20
- [PULL 09/22] hw/display: Fix mirrored output in dm163, Michael Tokarev, 2024/09/20
- [PULL 10/22] envlist: Remove unused envlist_parse,
Michael Tokarev <=
- [PULL 11/22] hw/sysbus: Remove unused sysbus_mmio_unmap, Michael Tokarev, 2024/09/20
- [PULL 13/22] tests/qemu-iotests/testenv: Use the "virt" machine for or1k, Michael Tokarev, 2024/09/20
- [PULL 12/22] util/cutils: Remove unused qemu_get_exec_dir, Michael Tokarev, 2024/09/20
- [PULL 14/22] tests/qemu-iotests/testenv: Use the "r2d" machine for sh4/sh4eb, Michael Tokarev, 2024/09/20
- [PULL 15/22] tests/functional: Put the or1k_sim test into the slow category, Michael Tokarev, 2024/09/20
- [PULL 16/22] target/hexagon: Rename macros.inc -> macros.h.inc, Michael Tokarev, 2024/09/20
- [PULL 17/22] tests/bench: Rename test_akcipher_keys.inc -> test_akcipher_keys.c.inc, Michael Tokarev, 2024/09/20
- [PULL 18/22] tests/functional: Correct typo in test_netdev_ethtool.py SPDX tag, Michael Tokarev, 2024/09/20
- [PULL 19/22] license: Simplify GPL-2.0-or-later license descriptions, Michael Tokarev, 2024/09/20
- [PULL 21/22] license: Update deprecated SPDX tag GPL-2.0+ to GPL-2.0-or-later, Michael Tokarev, 2024/09/20