]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lib: Replace virBuildPath() with g_build_filename()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 16 Oct 2023 07:40:58 +0000 (09:40 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 17 Oct 2023 06:32:13 +0000 (08:32 +0200)
Our virBuildPath() constructs a path from given arguments.
Exactly like g_build_filename(), except the latter is more
generic as it uses backslashes on Windows. Therefore, replace the
former with the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/kbase/internals/command.rst
src/util/virfcp.c
src/util/virhook.c
src/util/virpci.c

index 738fb5930a22cfbf4eef72f9655ca637cc01af70..064a7872e642a8dc366314c9448416c2d6b1a51d 100644 (file)
@@ -444,7 +444,7 @@ src/util/hooks.c
      g_autofree char *path = NULL;
      g_autoptr(virCommand) cmd = NULL;
 
-     virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
+     path = g_build_filename(LIBVIRT_HOOK_DIR, drvstr, NULL);
 
      cmd = virCommandNew(path);
 
index bb62fa90254dc86bfb2e35256494fb5e9293aaa6..052a6c99e1a375d41f6a6586ab5e3625809d2e13 100644 (file)
@@ -38,7 +38,7 @@ virFCIsCapableRport(const char *rport)
 {
     g_autofree char *path = NULL;
 
-    virBuildPath(&path, SYSFS_FC_RPORT_PATH, rport);
+    path = g_build_filename(SYSFS_FC_RPORT_PATH, rport, NULL);
 
     return virFileExists(path);
 }
index 50e178723f39deed798f5e96e4e3eb707675140c..d012bb1825765ef9c8e62872548e87391ab0cc42 100644 (file)
@@ -153,7 +153,7 @@ virHookCheck(int no, const char *driver)
         return -1;
     }
 
-    virBuildPath(&path, LIBVIRT_HOOK_DIR, driver);
+    path = g_build_filename(LIBVIRT_HOOK_DIR, driver, NULL);
 
     if (!virFileExists(path)) {
         VIR_DEBUG("No hook script %s", path);
@@ -398,7 +398,7 @@ virHookCall(int driver,
     if (extra == NULL)
         extra = "-";
 
-    virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
+    path = g_build_filename(LIBVIRT_HOOK_DIR, drvstr, NULL);
 
     script_ret = 1;
 
index 08b82708b14ea7809df86d64d15596073b8f4473..baacde4c14f783e97a44e5eaba29a5d703a2e5b0 100644 (file)
@@ -2396,7 +2396,7 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path,
 
     *pf = NULL;
 
-    virBuildPath(&device_link, vf_sysfs_path, "physfn");
+    device_link = g_build_filename(vf_sysfs_path, "physfn", NULL);
 
     if ((*pf = virPCIGetDeviceAddressFromSysfsLink(device_link))) {
         VIR_DEBUG("PF for VF device '%s': " VIR_PCI_DEVICE_ADDRESS_FMT,
@@ -2580,7 +2580,7 @@ virPCIGetNetName(const char *device_link_sysfs_path,
         return -1;
     }
 
-    virBuildPath(&pcidev_sysfs_net_path, device_link_sysfs_path, "net");
+    pcidev_sysfs_net_path = g_build_filename(device_link_sysfs_path, "net", NULL);
 
     if (virDirOpenQuiet(&dir, pcidev_sysfs_net_path) < 0) {
         /* this *isn't* an error - caller needs to check for netname == NULL */