]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virpcimock: Drop needless typecast
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 13 Aug 2019 09:03:05 +0000 (11:03 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Sat, 17 Aug 2019 09:16:52 +0000 (11:16 +0200)
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@redhat.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
tests/virpcimock.c

index c9f704f2c7b47f31cebfb2b18e9eddc60ae07836..3577d1bd41250e23ea5fc835b69ceb621f58017b 100644 (file)
@@ -121,7 +121,7 @@ struct pciDriver {
 };
 
 struct pciDevice {
-    char *id;
+    const char *id;
     int vendor;
     int device;
     int klass;
@@ -880,7 +880,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)