tree-wide: get rid of strappend()

It's a special case of strjoin(), so no need to keep both. In particular
as typing strjoin() is even shoert than strappend().
This commit is contained in:
Lennart Poettering
2019-07-12 14:31:12 +09:00
committed by Yu Watanabe
parent 6fa0524133
commit b910cc72c0
68 changed files with 115 additions and 146 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ static void setup_test_dir(char *tmp_dir, const char *files, ...) {
while (files) {
_cleanup_free_ char *path;
assert_se(path = strappend(tmp_dir, files));
assert_se(path = path_join(tmp_dir, files));
(void) mkdir_parents(path, 0755);
assert_se(write_string_file(path, "foobar", WRITE_STRING_FILE_CREATE) >= 0);
+4 -4
View File
@@ -92,7 +92,7 @@ static void test_copy_tree(void) {
STRV_FOREACH(p, files) {
_cleanup_free_ char *f;
assert_se(f = strappend(original_dir, *p));
assert_se(f = path_join(original_dir, *p));
assert_se(mkdir_parents(f, 0755) >= 0);
assert_se(write_string_file(f, "file", WRITE_STRING_FILE_CREATE) == 0);
@@ -101,8 +101,8 @@ static void test_copy_tree(void) {
STRV_FOREACH_PAIR(link, p, links) {
_cleanup_free_ char *f, *l;
assert_se(f = strappend(original_dir, *p));
assert_se(l = strappend(original_dir, *link));
assert_se(f = path_join(original_dir, *p));
assert_se(l = path_join(original_dir, *link));
assert_se(mkdir_parents(l, 0755) >= 0);
assert_se(symlink(f, l) == 0);
@@ -117,7 +117,7 @@ static void test_copy_tree(void) {
_cleanup_free_ char *buf, *f;
size_t sz;
assert_se(f = strappend(copy_dir, *p));
assert_se(f = path_join(copy_dir, *p));
assert_se(access(f, F_OK) == 0);
assert_se(read_full_file(f, &buf, &sz) == 0);
+1 -1
View File
@@ -327,7 +327,7 @@ static void test_strv_resolve(void) {
search_dirs = strv_new("/dir1", "/dir2", "/dir3");
assert_se(search_dirs);
STRV_FOREACH(d, search_dirs) {
char *p = strappend(tmp_dir, *d);
char *p = path_join(tmp_dir, *d);
assert_se(p);
assert_se(strv_push(&absolute_dirs, p) == 0);
}
-17
View File
@@ -250,22 +250,6 @@ static void test_strrep(void) {
assert_se(streq(zero, ""));
}
static void test_strappend(void) {
_cleanup_free_ char *t1, *t2, *t3, *t4;
t1 = strappend(NULL, NULL);
assert_se(streq(t1, ""));
t2 = strappend(NULL, "suf");
assert_se(streq(t2, "suf"));
t3 = strappend("pre", NULL);
assert_se(streq(t3, "pre"));
t4 = strappend("pre", "suf");
assert_se(streq(t4, "presuf"));
}
static void test_string_has_cc(void) {
assert_se(string_has_cc("abc\1", NULL));
assert_se(string_has_cc("abc\x7f", NULL));
@@ -568,7 +552,6 @@ int main(int argc, char *argv[]) {
test_strextend();
test_strextend_with_separator();
test_strrep();
test_strappend();
test_string_has_cc();
test_ascii_strlower();
test_strshorten();