diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-04-10 12:21:44 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-04-10 16:23:46 +0200 |
commit | 6dd67163b8f173649e7dc73740f35274714caafc (patch) | |
tree | 7541332ff80412cef7c0bcf0b9a2f5378227c0f7 /src | |
parent | 0d67448869bd881fd6aea57de6da98800395cf1f (diff) |
util: remove normalize_env_assignment(), it's unused
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/util.c | 30 | ||||
-rw-r--r-- | src/shared/util.h | 2 | ||||
-rw-r--r-- | src/test/test-env-replace.c | 26 |
3 files changed, 0 insertions, 58 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 6e5c5ca61a..8372038d4d 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -3675,36 +3675,6 @@ static char *unquote(const char *s, const char* quotes) { return strdup(s); } -char *normalize_env_assignment(const char *s) { - _cleanup_free_ char *value = NULL; - const char *eq; - char *p, *name; - - eq = strchr(s, '='); - if (!eq) { - char *r, *t; - - r = strdup(s); - if (!r) - return NULL; - - t = strstrip(r); - if (t != r) - memmove(r, t, strlen(t) + 1); - - return r; - } - - name = strndupa(s, eq - s); - p = strdupa(eq + 1); - - value = unquote(strstrip(p), QUOTES); - if (!value) - return NULL; - - return strjoin(strstrip(name), "=", value, NULL); -} - int wait_for_terminate(pid_t pid, siginfo_t *status) { siginfo_t dummy; diff --git a/src/shared/util.h b/src/shared/util.h index 4a7f0da724..527867ce8b 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -522,8 +522,6 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); int touch(const char *path); -char *normalize_env_assignment(const char *s); - int wait_for_terminate(pid_t pid, siginfo_t *status); int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_code); diff --git a/src/test/test-env-replace.c b/src/test/test-env-replace.c index 8f1fcd992c..2e28c0c49b 100644 --- a/src/test/test-env-replace.c +++ b/src/test/test-env-replace.c @@ -136,31 +136,6 @@ static void test_replace_env_arg(void) { assert_se(strv_length(r) == 9); } -static void test_one_normalize(const char *input, const char *output) { - _cleanup_free_ char *t; - - t = normalize_env_assignment(input); - assert_se(t); - assert_se(streq(t, output)); -} - -static void test_normalize_env_assignment(void) { - test_one_normalize("foo=bar", "foo=bar"); - test_one_normalize("=bar", "=bar"); - test_one_normalize("foo=", "foo="); - test_one_normalize("=", "="); - test_one_normalize("", ""); - test_one_normalize("a=\"waldo\"", "a=waldo"); - test_one_normalize("a=\"waldo", "a=\"waldo"); - test_one_normalize("a=waldo\"", "a=waldo\""); - test_one_normalize("a=\'", "a='"); - test_one_normalize("a=\'\'", "a="); - test_one_normalize(" xyz ", "xyz"); - test_one_normalize(" xyz = bar ", "xyz=bar"); - test_one_normalize(" xyz = 'bar ' ", "xyz=bar "); - test_one_normalize(" ' xyz' = 'bar ' ", "' xyz'=bar "); -} - static void test_env_clean(void) { _cleanup_strv_free_ char **e; @@ -209,7 +184,6 @@ int main(int argc, char *argv[]) { test_strv_env_set(); test_strv_env_merge(); test_replace_env_arg(); - test_normalize_env_assignment(); test_env_clean(); test_env_name_is_valid(); |