diff options
author | Dr. David Alan Gilbert <dave@treblig.org> | 2024-09-18 01:18:23 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2024-09-20 10:00:27 +0300 |
commit | 0058f85f20d1adff61d424c623a27da9f869925b (patch) | |
tree | d88e79056339d009a86841577b40530d6c0a1922 /util | |
parent | d524be28c5933a9d7605955a2368212a31c72d16 (diff) |
envlist: Remove unused envlist_parse
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>
Diffstat (limited to 'util')
-rw-r--r-- | util/envlist.c | 69 |
1 files changed, 0 insertions, 69 deletions
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. */ @@ -52,72 +49,6 @@ envlist_free(envlist_t *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). * |