chiark / gitweb /
util: drop parse_user_at_host() since its unused now
authorLennart Poettering <lennart@poettering.net>
Tue, 11 Feb 2014 15:45:15 +0000 (16:45 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 11 Feb 2014 16:16:07 +0000 (17:16 +0100)
src/shared/util.c
src/shared/util.h
src/test/test-util.c

index f76ed6f563cf32eb2ef524e30a694e7d12e3a4dd..21edd3ac2f38ab47e5c3453e626f4171ba557d72 100644 (file)
@@ -5838,20 +5838,6 @@ bool id128_is_valid(const char *s) {
         return true;
 }
 
-void parse_user_at_host(char *arg, char **user, char **host) {
-        assert(arg);
-        assert(user);
-        assert(host);
-
-        *host = strchr(arg, '@');
-        if (*host == NULL)
-                *host = arg;
-        else {
-                *host[0]++ = '\0';
-                *user = arg;
-        }
-}
-
 int split_pair(const char *s, const char *sep, char **l, char **r) {
         char *x, *a, *b;
 
index 219e4897b38bc78cc384f3a6aec1fea26e352041..9aea3a4e505ffe59b616e13fb2aabd67f2ad86bf 100644 (file)
@@ -833,7 +833,6 @@ static inline void _reset_locale_(struct _locale_struct_ *s) {
              _saved_locale_.quit = true)
 
 bool id128_is_valid(const char *s) _pure_;
-void parse_user_at_host(char *arg, char **user, char **host);
 
 int split_pair(const char *s, const char *sep, char **l, char **r);
 
index 9d6f4be5023690386848683314238f219a818b59..cbd60d68f7ff2a01533b5fec18a072f16fbb53ad 100644 (file)
@@ -490,21 +490,6 @@ static void test_strrep(void) {
         assert_se(streq(zero, ""));
 }
 
-static void test_parse_user_at_host(void) {
-        _cleanup_free_ char *both = strdup("waldo@waldoscomputer");
-        _cleanup_free_ char *onlyhost = strdup("mikescomputer");
-        char *user = NULL, *host = NULL;
-
-        parse_user_at_host(both, &user, &host);
-        assert_se(streq(user, "waldo"));
-        assert_se(streq(host, "waldoscomputer"));
-
-        user = host = NULL;
-        parse_user_at_host(onlyhost, &user, &host);
-        assert_se(user == NULL);
-        assert_se(streq(host, "mikescomputer"));
-}
-
 static void test_split_pair(void) {
         _cleanup_free_ char *a = NULL, *b = NULL;
 
@@ -635,7 +620,6 @@ int main(int argc, char *argv[]) {
         test_parse_bytes();
         test_strextend();
         test_strrep();
-        test_parse_user_at_host();
         test_split_pair();
         test_fstab_node_to_udev_node();
         test_get_files_in_directory();