[libvirt] [PATCH 04/18] virpcimock: Drop needless typecast

Michal Privoznik mprivozn at redhat.com
Wed Aug 14 11:57:33 UTC 2019


When creating a PCI device, the pciDevice structure contains @id
member which holds device address (DDDD.BB:DD.F) and is type of
'char *'. But the structure is initialized from a const char and
in fact we never modify or free the @id.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/virpcimock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 1c21e4e045..853ac588e9 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -120,7 +120,7 @@ struct pciDriver {
 };
 
 struct pciDevice {
-    char *id;
+    const char *id;
     int vendor;
     int device;
     int klass;
@@ -878,7 +878,7 @@ init_env(void)
 
 # define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \
     do { \
-        struct pciDevice dev = {.id = (char *)Id, .vendor = Vendor, \
+        struct pciDevice dev = {.id = Id, .vendor = Vendor, \
                                 .device = Device, __VA_ARGS__}; \
         pci_device_new_from_stub(&dev); \
     } while (0)
-- 
2.21.0




More information about the libvir-list mailing list