]> git.ipfire.org Git - pakfire.git/commitdiff
path: Rename join -> append
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 6 Oct 2023 13:56:50 +0000 (13:56 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 6 Oct 2023 13:56:50 +0000 (13:56 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c
src/libpakfire/cgroup.c
src/libpakfire/compress.c
src/libpakfire/include/pakfire/path.h
src/libpakfire/jail.c
src/libpakfire/mount.c
src/libpakfire/pakfire.c
src/libpakfire/path.c
src/libpakfire/repo.c
tests/libpakfire/path.c

index 30df7ac9e0173b2107d8df1882f68cbda7a5961c..da2848fd074522bcedb9b49399925c6bce964df6 100644 (file)
@@ -284,7 +284,7 @@ static int pakfire_build_read_script(struct pakfire_build* build,
        int r;
 
        // Compose the source path
-       r = pakfire_path_join(path, PAKFIRE_SCRIPTS_DIR, filename);
+       r = pakfire_path_append(path, PAKFIRE_SCRIPTS_DIR, filename);
        if (r) {
                ERROR(build->pakfire, "Could not compose path for script '%s': %m\n", filename);
                goto ERROR;
index 8b76cbc67643413dde568e2efee5325f76fbda10..d40b68fed8ceec9b34b4421cc7a4a93782ce57a9 100644 (file)
@@ -267,7 +267,7 @@ static int __pakfire_cgroup_create(struct pakfire_cgroup* cgroup) {
        DEBUG(cgroup->pakfire, "Trying to create cgroup %s\n", pakfire_cgroup_name(cgroup));
 
        // Compose the absolute path
-       r = pakfire_path_join(path, cgroup->root, cgroup->path);
+       r = pakfire_path_append(path, cgroup->root, cgroup->path);
        if (r)
                return 1;
 
@@ -645,7 +645,7 @@ int pakfire_cgroup_child(struct pakfire_cgroup** child,
        }
 
        // Join paths
-       r = pakfire_path_join(path, cgroup->path, name);
+       r = pakfire_path_append(path, cgroup->path, name);
        if (r)
                return 1;
 
index 4e8a0928db9896d17bff567d5f9247922bf53a28..5a2ecf6f54ddc1ba09b7820e24f3c3cb199f62c8 100644 (file)
@@ -686,7 +686,7 @@ static int __pakfire_extract(struct pakfire* pakfire, struct archive* a,
        // Prepend the prefix
        if (*data->prefix) {
                // Compose file path
-               r = pakfire_path_join(buffer, data->prefix, path);
+               r = pakfire_path_append(buffer, data->prefix, path);
                if (r) {
                        ERROR(pakfire, "Could not compose file path: %m\n");
                        goto ERROR;
@@ -698,7 +698,7 @@ static int __pakfire_extract(struct pakfire* pakfire, struct archive* a,
                // Update hardlink destination
                const char* link = archive_entry_hardlink(entry);
                if (link) {
-                       r = pakfire_path_join(buffer, data->prefix, link);
+                       r = pakfire_path_append(buffer, data->prefix, link);
                        if (r) {
                                ERROR(pakfire, "Could not compose hardlink path: %m\n");
                                goto ERROR;
index e9b533c758dbc517dfa4f005af24a82b14ea12f8..f35a87274fffb5b06ef91d73dfd84359807bafea 100644 (file)
@@ -27,8 +27,8 @@
        __pakfire_path_normalize(path, sizeof(path))
 int __pakfire_path_normalize(char* p, const size_t length);
 
-#define pakfire_path_join(path, s1, s2) \
-       __pakfire_path_join(path, sizeof(path), s1, s2)
-int __pakfire_path_join(char* buffer, const size_t length, const char* s1, const char* s2);
+#define pakfire_path_append(path, s1, s2) \
+       __pakfire_path_append(path, sizeof(path), s1, s2)
+int __pakfire_path_append(char* buffer, const size_t length, const char* s1, const char* s2);
 
 #endif /* PAKFIRE_PATH_H */
index 4a7af06e8edd6161def756a3f21849467455b8e7..52291408dc2c7fb8663698f4c100aefb94d847b8 100644 (file)
@@ -2081,7 +2081,7 @@ int pakfire_jail_exec_script(struct pakfire_jail* jail,
        const char* root = pakfire_get_path(jail->pakfire);
 
        // Write the scriptlet to disk
-       r = pakfire_path_join(path, root, PAKFIRE_TMP_DIR "/pakfire-script.XXXXXX");
+       r = pakfire_path_append(path, root, PAKFIRE_TMP_DIR "/pakfire-script.XXXXXX");
        if (r)
                goto ERROR;
 
index ec9537a60b1698e244a77096c2632c596e483efe..25641985ed9d211e04381ec4903c83996119d869 100644 (file)
@@ -405,7 +405,7 @@ int pakfire_mount_all(struct pakfire* pakfire, int flags) {
 
        for (const struct pakfire_mountpoint* mp = mountpoints; mp->source; mp++) {
                // Figure out where to mount
-               r = pakfire_path_join(target, root, mp->target);
+               r = pakfire_path_append(target, root, mp->target);
                if (r)
                        return r;
 
index 099ee927913e9a646c3d6882aa9a44bf75ec2681..2cbc2c75004a64499e2b2cbd5291a59aabf68179 100644 (file)
@@ -1203,7 +1203,7 @@ int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length,
                return r;
 
        // Join paths together
-       return __pakfire_path_join(path, length, pakfire->path, buffer);
+       return __pakfire_path_append(path, length, pakfire->path, buffer);
 }
 
 const char* pakfire_relpath(struct pakfire* pakfire, const char* path) {
@@ -1226,7 +1226,7 @@ int __pakfire_cache_path(struct pakfire* pakfire, char* path, size_t length,
                return r;
 
        // Join paths together
-       return __pakfire_path_join(path, length, pakfire->cache_path, buffer);
+       return __pakfire_path_append(path, length, pakfire->cache_path, buffer);
 }
 
 magic_t pakfire_get_magic(struct pakfire* pakfire) {
index 16ac09b5698b8a2a910c361ce24c2b604e4cdf5e..1a2b23afff729ea050d3d1623269f2ba9bf6154e 100644 (file)
@@ -46,7 +46,7 @@ static void pakfire_path_free(struct pakfire_path* path) {
        free(path);
 }
 
-static int pakfire_path_append(struct pakfire_path* path, const char* segment) {
+static int pakfire_path_append_segment(struct pakfire_path* path, const char* segment) {
        char* s = NULL;
 
        // Make space
@@ -104,7 +104,7 @@ static int pakfire_path_import_segments(struct pakfire_path* path, const char* s
 
        // Append all segments
        while (segment) {
-               r = pakfire_path_append(path, segment);
+               r = pakfire_path_append_segment(path, segment);
                if (r)
                        break;
 
@@ -245,7 +245,7 @@ ERROR:
        return r;
 }
 
-int __pakfire_path_join(char* buffer, const size_t length, const char* s1, const char* s2) {
+int __pakfire_path_append(char* buffer, const size_t length, const char* s1, const char* s2) {
        struct pakfire_path* path = NULL;
        int r;
 
index 05465fadc2a14b75c1d0092c480ae42e6b9e4a67..7c7442626a3894a9a7b03e5145b5ae2dcf18357f 100644 (file)
@@ -2002,7 +2002,7 @@ PAKFIRE_EXPORT int pakfire_repo_compose(struct pakfire* pakfire, const char* pat
                                goto OUT;
 
                        // Make the path absolute
-                       r = pakfire_path_join(destination_path, realpath, repo_path);
+                       r = pakfire_path_append(destination_path, realpath, repo_path);
                        if (r)
                                goto OUT;
 
index b7ba771c7183c6cff9a99fb89a024af8699243c5..1fab35bc4c0e0e68e6ee0c443f2515dbc352d509 100644 (file)
@@ -58,16 +58,16 @@ FAIL:
        return EXIT_FAILURE;
 }
 
-static int test_path_join(const struct test* t) {
+static int test_path_append(const struct test* t) {
        char path[PATH_MAX];
 
-       ASSERT_SUCCESS(pakfire_path_join(path, "/usr/bin", "bash"));
+       ASSERT_SUCCESS(pakfire_path_append(path, "/usr/bin", "bash"));
        ASSERT_STRING_EQUALS(path, "/usr/bin/bash");
 
-       ASSERT_SUCCESS(pakfire_path_join(path, "/usr/bin", "/bash"));
+       ASSERT_SUCCESS(pakfire_path_append(path, "/usr/bin", "/bash"));
        ASSERT_STRING_EQUALS(path, "/usr/bin/bash");
 
-       ASSERT_SUCCESS(pakfire_path_join(path, "/usr/bin/sh", "../bash"));
+       ASSERT_SUCCESS(pakfire_path_append(path, "/usr/bin/sh", "../bash"));
        ASSERT_STRING_EQUALS(path, "/usr/bin/bash");
 
        return EXIT_SUCCESS;
@@ -78,7 +78,7 @@ FAIL:
 
 int main(int argc, const char* argv[]) {
        testsuite_add_test(test_path_normalize);
-       testsuite_add_test(test_path_join);
+       testsuite_add_test(test_path_append);
 
        return testsuite_run(argc, argv);
 }