From: Michael Tremer Date: Fri, 6 Oct 2023 13:56:50 +0000 (+0000) Subject: path: Rename join -> append X-Git-Tag: 0.9.30~1534 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=819232d66a4095db7d1524a549ada8266293f5c1;p=pakfire.git path: Rename join -> append Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index 30df7ac9e..da2848fd0 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -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; diff --git a/src/libpakfire/cgroup.c b/src/libpakfire/cgroup.c index 8b76cbc67..d40b68fed 100644 --- a/src/libpakfire/cgroup.c +++ b/src/libpakfire/cgroup.c @@ -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; diff --git a/src/libpakfire/compress.c b/src/libpakfire/compress.c index 4e8a0928d..5a2ecf6f5 100644 --- a/src/libpakfire/compress.c +++ b/src/libpakfire/compress.c @@ -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; diff --git a/src/libpakfire/include/pakfire/path.h b/src/libpakfire/include/pakfire/path.h index e9b533c75..f35a87274 100644 --- a/src/libpakfire/include/pakfire/path.h +++ b/src/libpakfire/include/pakfire/path.h @@ -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 */ diff --git a/src/libpakfire/jail.c b/src/libpakfire/jail.c index 4a7af06e8..52291408d 100644 --- a/src/libpakfire/jail.c +++ b/src/libpakfire/jail.c @@ -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; diff --git a/src/libpakfire/mount.c b/src/libpakfire/mount.c index ec9537a60..25641985e 100644 --- a/src/libpakfire/mount.c +++ b/src/libpakfire/mount.c @@ -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; diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index 099ee9279..2cbc2c750 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -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) { diff --git a/src/libpakfire/path.c b/src/libpakfire/path.c index 16ac09b56..1a2b23aff 100644 --- a/src/libpakfire/path.c +++ b/src/libpakfire/path.c @@ -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; diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index 05465fadc..7c7442626 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -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; diff --git a/tests/libpakfire/path.c b/tests/libpakfire/path.c index b7ba771c7..1fab35bc4 100644 --- a/tests/libpakfire/path.c +++ b/tests/libpakfire/path.c @@ -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); }