From 4d2b873211b498c9377b1dc8370c3bf336de16ab Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 19 Mar 2025 16:37:18 +0000 Subject: [PATCH] tests: Use g_build_filename() rather than g_strdup_printf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the `g-file-info-filesystem-readonly` test. This doesn’t introduce any functional changes, but makes the code a little easier to read (because the parts of the path are now in hierarchical order) and makes it a bit clearer that we’re building a path rather than an arbitrary string. Signed-off-by: Philip Withnall --- gio/tests/g-file-info-filesystem-readonly.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gio/tests/g-file-info-filesystem-readonly.c b/gio/tests/g-file-info-filesystem-readonly.c index af2069dc7..e4af3045f 100644 --- a/gio/tests/g-file-info-filesystem-readonly.c +++ b/gio/tests/g-file-info-filesystem-readonly.c @@ -128,9 +128,9 @@ test_filesystem_readonly (gconstpointer with_mount_monitor) } curdir = g_get_current_dir (); - dir_to_mount = g_strdup_printf ("%s/dir_bindfs_to_mount", curdir); - file_in_mount = g_strdup_printf ("%s/example.txt", dir_to_mount); - dir_mountpoint = g_strdup_printf ("%s/dir_bindfs_mountpoint", curdir); + dir_to_mount = g_build_filename (curdir, "dir_bindfs_to_mount", NULL); + file_in_mount = g_build_filename (dir_to_mount, "example.txt", NULL); + dir_mountpoint = g_build_filename (curdir, "dir_bindfs_mountpoint", NULL); g_mkdir (dir_to_mount, 0777); g_mkdir (dir_mountpoint, 0777); @@ -172,7 +172,7 @@ test_filesystem_readonly (gconstpointer with_mount_monitor) } /* Let's check now, that the file is in indeed in a readonly filesystem */ - file_in_mountpoint = g_strdup_printf ("%s/example.txt", dir_mountpoint); + file_in_mountpoint = g_build_filename (dir_mountpoint, "example.txt", NULL); mounted_file = g_file_new_for_path (file_in_mountpoint); if (with_mount_monitor)