All users of virHashTable pass strings as the name/key of the entry. Make this an official requirement by turning the variables to 'const char *'. For any other case it's better to use glib's GHashTable. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/nwfilter_params.c | 2 +- src/conf/virchrdev.c | 2 +- src/conf/virdomainmomentobjlist.c | 6 ++-- src/conf/virdomainobjlist.c | 12 ++++---- src/conf/virinterfaceobj.c | 10 +++--- src/conf/virnetworkobj.c | 16 +++++----- src/conf/virnodedeviceobj.c | 18 +++++------ src/conf/virnwfilterbindingobjlist.c | 4 +-- src/conf/virsecretobj.c | 8 ++--- src/conf/virstorageobj.c | 22 +++++++------- src/hypervisor/virclosecallbacks.c | 2 +- src/locking/lock_daemon.c | 2 +- src/nwfilter/nwfilter_dhcpsnoop.c | 6 ++-- src/nwfilter/nwfilter_gentech_driver.c | 6 ++-- src/qemu/qemu_blockjob.c | 2 +- src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_checkpoint.c | 2 +- src/qemu/qemu_domain.c | 6 ++-- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_process.c | 2 +- src/qemu/qemu_snapshot.c | 4 +-- src/rpc/virnetdaemon.c | 14 ++++----- src/test/test_driver.c | 6 ++-- src/util/virfilecache.c | 2 +- src/util/virhash.c | 42 +++++++++++++------------- src/util/virhash.h | 32 ++++++++++---------- src/util/virlockspace.c | 2 +- src/util/virmacmap.c | 4 +-- tests/qemumonitorjsontest.c | 2 +- tests/qemusecuritymock.c | 8 ++--- tests/virhashtest.c | 10 +++--- 31 files changed, 129 insertions(+), 129 deletions(-) diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c index fd05b45ca3..73160a38a4 100644 --- a/src/conf/nwfilter_params.c +++ b/src/conf/nwfilter_params.c @@ -620,7 +620,7 @@ struct addToTableStruct { static int -addToTable(void *payload, const void *name, void *data) +addToTable(void *payload, const char *name, void *data) { struct addToTableStruct *atts = (struct addToTableStruct *)data; virNWFilterVarValuePtr val; diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 0d2c9503ab..5e5c03d03b 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -279,7 +279,7 @@ virChrdevsPtr virChrdevAlloc(void) * Helper to clear stream callbacks when freeing the hash */ static int virChrdevFreeClearCallbacks(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data G_GNUC_UNUSED) { virChrdevHashEntry *ent = payload; diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentobjlist.c index 43c77e6c54..511bf1d415 100644 --- a/src/conf/virdomainmomentobjlist.c +++ b/src/conf/virdomainmomentobjlist.c @@ -76,7 +76,7 @@ struct moment_act_on_descendant { static int virDomainMomentActOnDescendant(void *payload, - const void *name, + const char *name, void *data) { virDomainMomentObjPtr obj = payload; @@ -307,7 +307,7 @@ struct virDomainMomentNameData { static int virDomainMomentObjListCopyNames(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virDomainMomentObjPtr obj = payload; @@ -491,7 +491,7 @@ struct moment_set_relation { }; static int virDomainMomentSetRelations(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr obj = payload; diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 9e8757eff9..e9a4b271df 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -95,7 +95,7 @@ static void virDomainObjListDispose(void *obj) static int virDomainObjListSearchID(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *data) { virDomainObjPtr obj = (virDomainObjPtr)payload; @@ -649,7 +649,7 @@ struct virDomainObjListData { static int virDomainObjListCount(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virDomainObjPtr obj = payload; @@ -696,7 +696,7 @@ struct virDomainIDData { static int virDomainObjListCopyActiveIDs(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virDomainObjPtr obj = payload; @@ -741,7 +741,7 @@ struct virDomainNameData { static int virDomainObjListCopyInactiveNames(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virDomainObjPtr obj = payload; @@ -797,7 +797,7 @@ struct virDomainListIterData { static int virDomainObjListHelper(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virDomainListIterData *data = opaque; @@ -925,7 +925,7 @@ struct virDomainListData { static int virDomainObjListCollectIterator(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virDomainListData *data = opaque; diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index 1e29e12148..faf047dc5f 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -161,7 +161,7 @@ struct _virInterfaceObjFindMACData { static int virInterfaceObjListFindByMACStringCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virInterfaceObjPtr obj = payload; @@ -269,7 +269,7 @@ struct _virInterfaceObjListExportData { static int virInterfaceObjListExportCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virInterfaceObjListExportDataPtr data = opaque; @@ -361,7 +361,7 @@ struct _virInterfaceObjListCloneData { static int virInterfaceObjListCloneCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virInterfaceObjPtr srcObj = payload; @@ -480,7 +480,7 @@ struct _virInterfaceObjNumOfInterfacesData { static int virInterfaceObjListNumOfInterfacesCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virInterfaceObjPtr obj = payload; @@ -522,7 +522,7 @@ struct _virInterfaceObjGetNamesData { static int virInterfaceObjListGetNamesCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virInterfaceObjPtr obj = payload; diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 3e537e512e..46205b163c 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -402,7 +402,7 @@ virNetworkObjFindByUUID(virNetworkObjListPtr nets, static int virNetworkObjSearchName(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *data) { virNetworkObjPtr obj = (virNetworkObjPtr) payload; @@ -1178,7 +1178,7 @@ struct virNetworkObjBridgeInUseHelperData { static int virNetworkObjBridgeInUseHelper(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { int ret; @@ -1355,7 +1355,7 @@ struct _virNetworkObjListExportData { static int virNetworkObjListExportCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virNetworkObjListExportDataPtr data = opaque; @@ -1439,7 +1439,7 @@ struct virNetworkObjListForEachHelperData { static int virNetworkObjListForEachHelper(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virNetworkObjListForEachHelperData *data = opaque; @@ -1489,7 +1489,7 @@ struct virNetworkObjListGetHelperData { static int virNetworkObjListGetHelper(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virNetworkObjListGetHelperData *data = opaque; @@ -1576,7 +1576,7 @@ struct virNetworkObjListPruneHelperData { static int virNetworkObjListPruneHelper(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { const struct virNetworkObjListPruneHelperData *data = opaque; @@ -1756,7 +1756,7 @@ struct _virNetworkObjPortListExportData { static int virNetworkObjPortListExportCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virNetworkObjPortListExportDataPtr data = opaque; @@ -1834,7 +1834,7 @@ struct _virNetworkObjPortListForEachData { static int virNetworkObjPortForEachCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virNetworkObjPortListForEachData *data = opaque; diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index dcac4c36bb..f240abf315 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -199,7 +199,7 @@ virNodeDeviceObjListSearch(virNodeDeviceObjListPtr devs, static int virNodeDeviceObjListFindBySysfsPathCallback(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virNodeDeviceObjPtr obj = (virNodeDeviceObjPtr) payload; @@ -256,7 +256,7 @@ struct virNodeDeviceObjListFindByWWNsData { static int virNodeDeviceObjListFindByWWNsCallback(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virNodeDeviceObjPtr obj = (virNodeDeviceObjPtr) payload; @@ -292,7 +292,7 @@ virNodeDeviceObjListFindByWWNs(virNodeDeviceObjListPtr devs, static int virNodeDeviceObjListFindByFabricWWNCallback(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virNodeDeviceObjPtr obj = (virNodeDeviceObjPtr) payload; @@ -322,7 +322,7 @@ virNodeDeviceObjListFindByFabricWWN(virNodeDeviceObjListPtr devs, static int virNodeDeviceObjListFindByCapCallback(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virNodeDeviceObjPtr obj = (virNodeDeviceObjPtr) payload; @@ -354,7 +354,7 @@ struct virNodeDeviceObjListFindSCSIHostByWWNsData { static int virNodeDeviceObjListFindSCSIHostByWWNsCallback(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virNodeDeviceObjPtr obj = (virNodeDeviceObjPtr) payload; @@ -401,7 +401,7 @@ virNodeDeviceObjListFindSCSIHostByWWNs(virNodeDeviceObjListPtr devs, static int virNodeDeviceObjListFindMediatedDeviceByUUIDCallback(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virNodeDeviceObjPtr obj = (virNodeDeviceObjPtr) payload; @@ -729,7 +729,7 @@ struct virNodeDeviceCountData { static int virNodeDeviceObjListNumOfDevicesCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virNodeDeviceObjPtr obj = payload; @@ -777,7 +777,7 @@ struct virNodeDeviceGetNamesData { static int virNodeDeviceObjListGetNamesCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virNodeDeviceObjPtr obj = payload; @@ -884,7 +884,7 @@ struct _virNodeDeviceObjListExportData { static int virNodeDeviceObjListExportCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virNodeDeviceObjPtr obj = payload; diff --git a/src/conf/virnwfilterbindingobjlist.c b/src/conf/virnwfilterbindingobjlist.c index 6f4ad0bae6..4cbb62abfa 100644 --- a/src/conf/virnwfilterbindingobjlist.c +++ b/src/conf/virnwfilterbindingobjlist.c @@ -345,7 +345,7 @@ struct virNWFilterBindingListIterData { static int virNWFilterBindingObjListHelper(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virNWFilterBindingListIterData *data = opaque; @@ -379,7 +379,7 @@ struct virNWFilterBindingListData { static int virNWFilterBindingObjListCollectIterator(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virNWFilterBindingListData *data = opaque; diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index a3ae64ec53..146210fbe7 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -197,7 +197,7 @@ virSecretObjListFindByUUID(virSecretObjListPtr secrets, static int virSecretObjSearchName(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virSecretObjPtr obj = (virSecretObjPtr) payload; @@ -410,7 +410,7 @@ struct virSecretCountData { static int virSecretObjListNumOfSecretsCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virSecretCountData *data = opaque; @@ -443,7 +443,7 @@ struct virSecretListData { static int virSecretObjListGetUUIDsCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct virSecretListData *data = opaque; @@ -534,7 +534,7 @@ struct _virSecretObjListExportData { static int virSecretObjListExportCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virSecretObjListExportDataPtr data = opaque; diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 1edcc3e074..219594582c 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -421,7 +421,7 @@ struct _virStoragePoolObjListForEachData { static int virStoragePoolObjListForEachCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virStoragePoolObjPtr obj = payload; @@ -477,7 +477,7 @@ struct _virStoragePoolObjListSearchData { static int virStoragePoolObjListSearchCb(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virStoragePoolObjPtr obj = (virStoragePoolObjPtr) payload; @@ -728,7 +728,7 @@ struct _virStoragePoolObjForEachVolData { static int virStoragePoolObjForEachVolumeCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { int ret = 0; @@ -767,7 +767,7 @@ struct _virStoragePoolObjSearchVolData { static int virStoragePoolObjSearchVolumeCb(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virStorageVolObjPtr volobj = (virStorageVolObjPtr) payload; @@ -864,7 +864,7 @@ struct _virStorageVolObjCountData { static int virStoragePoolObjNumOfVolumesCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virStorageVolObjPtr volobj = payload; @@ -913,7 +913,7 @@ struct _virStorageVolObjNameData { static int virStoragePoolObjVolumeGetNamesCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virStorageVolObjPtr volobj = payload; @@ -983,7 +983,7 @@ struct _virStoragePoolObjVolumeListExportData { static int virStoragePoolObjVolumeListExportCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virStorageVolObjPtr volobj = payload; @@ -1430,7 +1430,7 @@ struct _virStoragePoolObjFindDuplicateData { static int virStoragePoolObjSourceFindDuplicateCb(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virStoragePoolObjPtr obj = (virStoragePoolObjPtr) payload; @@ -1832,7 +1832,7 @@ struct _virStoragePoolCountData { static int virStoragePoolObjNumOfStoragePoolsCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virStoragePoolObjPtr obj = payload; @@ -1884,7 +1884,7 @@ struct _virStoragePoolNameData { static int virStoragePoolObjGetNamesCb(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virStoragePoolObjPtr obj = payload; @@ -2027,7 +2027,7 @@ struct _virStoragePoolObjListExportData { static int virStoragePoolObjListExportCallback(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virStoragePoolObjPtr obj = payload; diff --git a/src/hypervisor/virclosecallbacks.c b/src/hypervisor/virclosecallbacks.c index a73ab818da..d87fe84505 100644 --- a/src/hypervisor/virclosecallbacks.c +++ b/src/hypervisor/virclosecallbacks.c @@ -246,7 +246,7 @@ struct virCloseCallbacksData { static int virCloseCallbacksGetOne(void *payload, - const void *key, + const char *key, void *opaque) { struct virCloseCallbacksData *data = opaque; diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index f1dabe56cd..8f16dfd064 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -362,7 +362,7 @@ struct virLockDaemonClientReleaseData { static int virLockDaemonClientReleaseLockspace(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virLockSpacePtr lockspace = payload; diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index a9cbaccdad..c425af497c 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -1754,7 +1754,7 @@ virNWFilterSnoopLeaseFileSave(virNWFilterSnoopIPLeasePtr ipl) */ static int virNWFilterSnoopPruneIter(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *data G_GNUC_UNUSED) { virNWFilterSnoopReqPtr req = (virNWFilterSnoopReqPtr)payload; @@ -1784,7 +1784,7 @@ virNWFilterSnoopPruneIter(const void *payload, */ static int virNWFilterSnoopSaveIter(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virNWFilterSnoopReqPtr req = payload; @@ -1951,7 +1951,7 @@ virNWFilterSnoopJoinThreads(void) */ static int virNWFilterSnoopRemAllReqIter(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *data G_GNUC_UNUSED) { virNWFilterSnoopReqPtr req = (virNWFilterSnoopReqPtr)payload; diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index 073c91550a..ca6455c70d 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -140,12 +140,12 @@ struct printString static int -printString(void *payload G_GNUC_UNUSED, const void *name, void *data) +printString(void *payload G_GNUC_UNUSED, const char *name, void *data) { struct printString *ps = data; - if ((STREQ((char *)name, NWFILTER_STD_VAR_IP) && !ps->reportIP) || - (STREQ((char *)name, NWFILTER_STD_VAR_MAC) && !ps->reportMAC)) + if ((STREQ(name, NWFILTER_STD_VAR_IP) && !ps->reportIP) || + (STREQ(name, NWFILTER_STD_VAR_MAC) && !ps->reportMAC)) return 0; if (virBufferUse(&ps->buf) && ps->separator) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index c49c98e547..ed4a32e964 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -481,7 +481,7 @@ qemuBlockJobIsRunning(qemuBlockJobDataPtr job) /* returns 1 for a job we didn't reconnect to */ static int qemuBlockJobRefreshJobsFindInactive(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *data G_GNUC_UNUSED) { const qemuBlockJobData *job = payload; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2249d035fb..a67fb785b5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2156,7 +2156,7 @@ struct virQEMUCapsSearchDomcapsData { static int virQEMUCapsSearchDomcaps(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virDomainCapsPtr domCaps = (virDomainCapsPtr) payload; diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index f45ab29d4c..fb76c211f8 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -744,7 +744,7 @@ struct virQEMUCheckpointReparent { static int qemuCheckpointReparentChildren(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr moment = payload; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bea43a1aba..161b369712 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2106,7 +2106,7 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job, static int qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { struct qemuDomainPrivateBlockJobFormatData *data = opaque; @@ -6641,7 +6641,7 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver, /* Hash iterator callback to discard multiple snapshots. */ int qemuDomainMomentDiscardAll(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr moment = payload; @@ -10718,7 +10718,7 @@ qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason) static int qemuDomainDefHasManagedPRBlockjobIterator(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { qemuBlockJobDataPtr job = payload; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 91b3b67cb6..fc69678f9b 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -638,7 +638,7 @@ struct _virQEMUMomentRemove { }; int qemuDomainMomentDiscardAll(void *payload, - const void *name, + const char *name, void *data); int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 89f6fd1499..91db2319fb 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8067,7 +8067,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, static int qemuProcessRefreshLegacyBlockjob(void *payload, - const void *name, + const char *name, void *opaque) { const char *jobname = name; diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 47df102817..a6241ab5d4 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -75,7 +75,7 @@ qemuSnapObjFromSnapshot(virDomainObjPtr vm, /* Count how many snapshots in a set are external snapshots. */ static int qemuSnapshotCountExternal(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr snap = payload; @@ -2265,7 +2265,7 @@ struct _virQEMUMomentReparent { static int qemuSnapshotChildrenReparent(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr moment = payload; diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index 3e2af53e82..ce13f0d927 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -86,7 +86,7 @@ static virClassPtr virNetDaemonClass; static int daemonServerClose(void *payload, - const void *key G_GNUC_UNUSED, + const char *key G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED); static void @@ -228,7 +228,7 @@ struct collectData { static int collectServers(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque) { virNetServerPtr srv = virObjectRef(payload); @@ -731,7 +731,7 @@ virNetDaemonAutoShutdownTimer(int timerid G_GNUC_UNUSED, static int daemonServerUpdateServices(void *payload, - const void *key G_GNUC_UNUSED, + const char *key G_GNUC_UNUSED, void *opaque) { bool *enable = opaque; @@ -752,7 +752,7 @@ virNetDaemonUpdateServices(virNetDaemonPtr dmn, static int daemonServerProcessClients(void *payload, - const void *key G_GNUC_UNUSED, + const char *key G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { virNetServerPtr srv = payload; @@ -763,7 +763,7 @@ daemonServerProcessClients(void *payload, static int daemonServerShutdownWait(void *payload, - const void *key G_GNUC_UNUSED, + const char *key G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { virNetServerPtr srv = payload; @@ -913,7 +913,7 @@ virNetDaemonQuit(virNetDaemonPtr dmn) static int daemonServerClose(void *payload, - const void *key G_GNUC_UNUSED, + const char *key G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { virNetServerPtr srv = payload; @@ -924,7 +924,7 @@ daemonServerClose(void *payload, static int daemonServerHasClients(void *payload, - const void *key G_GNUC_UNUSED, + const char *key G_GNUC_UNUSED, void *opaque) { bool *clients = opaque; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index bb26fc247c..5c02a8ebb0 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -8592,7 +8592,7 @@ struct _testMomentRemoveData { static int testDomainSnapshotDiscardAll(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr snap = payload; @@ -8612,7 +8612,7 @@ struct _testMomentReparentData { static int testDomainMomentReparentChildren(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr moment = payload; @@ -8906,7 +8906,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, static int testDomainCheckpointDiscardAll(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data) { virDomainMomentObjPtr chk = payload; diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c index 6d75e2e4fb..cfb1d1d247 100644 --- a/src/util/virfilecache.c +++ b/src/util/virfilecache.c @@ -337,7 +337,7 @@ virFileCacheLookupByFunc(virFileCachePtr cache, virObjectLock(cache); - data = virHashSearch(cache->table, iter, iterData, (void **)&name); + data = virHashSearch(cache->table, iter, iterData, &name); virFileCacheValidate(cache, name, &data); virObjectRef(data); diff --git a/src/util/virhash.c b/src/util/virhash.c index 8d56b4bb85..f386839d6b 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -43,7 +43,7 @@ typedef struct _virHashEntry virHashEntry; typedef virHashEntry *virHashEntryPtr; struct _virHashEntry { struct _virHashEntry *next; - void *name; + char *name; void *payload; }; @@ -82,37 +82,37 @@ static int virHashAtomicOnceInit(void) VIR_ONCE_GLOBAL_INIT(virHashAtomic); -static uint32_t virHashStrCode(const void *name, uint32_t seed) +static uint32_t virHashStrCode(const char *name, uint32_t seed) { return virHashCodeGen(name, strlen(name), seed); } -static bool virHashStrEqual(const void *namea, const void *nameb) +static bool virHashStrEqual(const char *namea, const char *nameb) { return STREQ(namea, nameb); } -static void *virHashStrCopy(const void *name) +static char *virHashStrCopy(const char *name) { return g_strdup(name); } static char * -virHashStrPrintHuman(const void *name) +virHashStrPrintHuman(const char *name) { return g_strdup(name); } -static void virHashStrFree(void *name) +static void virHashStrFree(char *name) { VIR_FREE(name); } static size_t -virHashComputeKey(const virHashTable *table, const void *name) +virHashComputeKey(const virHashTable *table, const char *name) { uint32_t value = table->keyCode(name, table->seed); return value % table->size; @@ -272,7 +272,7 @@ virHashFree(virHashTablePtr table) } static int -virHashAddOrUpdateEntry(virHashTablePtr table, const void *name, +virHashAddOrUpdateEntry(virHashTablePtr table, const char *name, void *userdata, bool is_update) { @@ -337,7 +337,7 @@ virHashAddOrUpdateEntry(virHashTablePtr table, const void *name, * Returns 0 the addition succeeded and -1 in case of error. */ int -virHashAddEntry(virHashTablePtr table, const void *name, void *userdata) +virHashAddEntry(virHashTablePtr table, const char *name, void *userdata) { return virHashAddOrUpdateEntry(table, name, userdata, false); } @@ -355,7 +355,7 @@ virHashAddEntry(virHashTablePtr table, const void *name, void *userdata) * Returns 0 the addition succeeded and -1 in case of error. */ int -virHashUpdateEntry(virHashTablePtr table, const void *name, +virHashUpdateEntry(virHashTablePtr table, const char *name, void *userdata) { return virHashAddOrUpdateEntry(table, name, userdata, true); @@ -363,7 +363,7 @@ virHashUpdateEntry(virHashTablePtr table, const void *name, int virHashAtomicUpdate(virHashAtomicPtr table, - const void *name, + const char *name, void *userdata) { int ret; @@ -378,7 +378,7 @@ virHashAtomicUpdate(virHashAtomicPtr table, static virHashEntryPtr virHashGetEntry(const virHashTable *table, - const void *name) + const char *name) { size_t key; virHashEntryPtr entry; @@ -406,7 +406,7 @@ virHashGetEntry(const virHashTable *table, * Returns a pointer to the userdata */ void * -virHashLookup(const virHashTable *table, const void *name) +virHashLookup(const virHashTable *table, const char *name) { virHashEntryPtr entry = virHashGetEntry(table, name); @@ -428,7 +428,7 @@ virHashLookup(const virHashTable *table, const void *name) */ bool virHashHasEntry(const virHashTable *table, - const void *name) + const char *name) { return !!virHashGetEntry(table, name); } @@ -444,7 +444,7 @@ virHashHasEntry(const virHashTable *table, * * Returns a pointer to the userdata */ -void *virHashSteal(virHashTablePtr table, const void *name) +void *virHashSteal(virHashTablePtr table, const char *name) { void *data = virHashLookup(table, name); if (data) { @@ -458,7 +458,7 @@ void *virHashSteal(virHashTablePtr table, const void *name) void * virHashAtomicSteal(virHashAtomicPtr table, - const void *name) + const char *name) { void *data; @@ -500,7 +500,7 @@ virHashSize(const virHashTable *table) * Returns 0 if the removal succeeded and -1 in case of error or not found. */ int -virHashRemoveEntry(virHashTablePtr table, const void *name) +virHashRemoveEntry(virHashTablePtr table, const char *name) { virHashEntryPtr entry; virHashEntryPtr *nextptr; @@ -615,7 +615,7 @@ virHashRemoveSet(virHashTablePtr table, static int _virHashRemoveAllIter(const void *payload G_GNUC_UNUSED, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *data G_GNUC_UNUSED) { return 1; @@ -654,7 +654,7 @@ virHashRemoveAll(virHashTablePtr table) void *virHashSearch(const virHashTable *ctable, virHashSearcher iter, const void *data, - void **name) + char **name) { size_t i; @@ -685,7 +685,7 @@ struct getKeysIter }; static int virHashGetKeysIterator(void *payload, - const void *key, void *data) + const char *key, void *data) { struct getKeysIter *iter = data; @@ -728,7 +728,7 @@ struct virHashEqualData virHashValueComparator compar; }; -static int virHashEqualSearcher(const void *payload, const void *name, +static int virHashEqualSearcher(const void *payload, const char *name, const void *data) { struct virHashEqualData *vhed = (void *)data; diff --git a/src/util/virhash.h b/src/util/virhash.h index a9b022f362..78c7459390 100644 --- a/src/util/virhash.h +++ b/src/util/virhash.h @@ -40,7 +40,7 @@ typedef void (*virHashDataFree) (void *payload); * * Returns -1 to stop the iteration, e.g. in case of an error */ -typedef int (*virHashIterator) (void *payload, const void *name, void *data); +typedef int (*virHashIterator) (void *payload, const char *name, void *data); /** * virHashSearcher: * @payload: the data in the hash @@ -51,7 +51,7 @@ typedef int (*virHashIterator) (void *payload, const void *name, void *data); * Returns 1 if the hash entry is desired, 0 to move * to next entry */ -typedef int (*virHashSearcher) (const void *payload, const void *name, +typedef int (*virHashSearcher) (const void *payload, const char *name, const void *data); /** @@ -64,7 +64,7 @@ typedef int (*virHashSearcher) (const void *payload, const void *name, * * Returns the hash code */ -typedef uint32_t (*virHashKeyCode)(const void *name, +typedef uint32_t (*virHashKeyCode)(const char *name, uint32_t seed); /** * virHashKeyEqual: @@ -75,7 +75,7 @@ typedef uint32_t (*virHashKeyCode)(const void *name, * * Returns true if the keys are equal, false otherwise */ -typedef bool (*virHashKeyEqual)(const void *namea, const void *nameb); +typedef bool (*virHashKeyEqual)(const char *namea, const char *nameb); /** * virHashKeyCopy: * @name: the hash key @@ -86,7 +86,7 @@ typedef bool (*virHashKeyEqual)(const void *namea, const void *nameb); * Returns a copy of @name which will eventually be passed to the * 'virHashKeyFree' callback at the end of its lifetime. */ -typedef void *(*virHashKeyCopy)(const void *name); +typedef char *(*virHashKeyCopy)(const char *name); /** * virHashKeyPrintHuman: * @name: the hash key @@ -97,7 +97,7 @@ typedef void *(*virHashKeyCopy)(const void *name); * Returns a string representation of the key for use in error messages. Caller * promises to always free the returned string. */ -typedef char *(*virHashKeyPrintHuman) (const void *name); +typedef char *(*virHashKeyPrintHuman) (const char *name); /** * virHashKeyFree: @@ -106,7 +106,7 @@ typedef char *(*virHashKeyPrintHuman) (const void *name); * Free any memory associated with the hash * key @name */ -typedef void (*virHashKeyFree)(void *name); +typedef void (*virHashKeyFree)(char *name); /* * Constructor and destructor. @@ -120,19 +120,19 @@ ssize_t virHashSize(const virHashTable *table); * Add a new entry to the hash table. */ int virHashAddEntry(virHashTablePtr table, - const void *name, void *userdata); + const char *name, void *userdata); int virHashUpdateEntry(virHashTablePtr table, - const void *name, + const char *name, void *userdata); int virHashAtomicUpdate(virHashAtomicPtr table, - const void *name, + const char *name, void *userdata); /* * Remove an entry from the hash table. */ int virHashRemoveEntry(virHashTablePtr table, - const void *name); + const char *name); /* * Remove all entries from the hash table. @@ -142,15 +142,15 @@ ssize_t virHashRemoveAll(virHashTablePtr table); /* * Retrieve the userdata. */ -void *virHashLookup(const virHashTable *table, const void *name); -bool virHashHasEntry(const virHashTable *table, const void *name); +void *virHashLookup(const virHashTable *table, const char *name); +bool virHashHasEntry(const virHashTable *table, const char *name); /* * Retrieve & remove the userdata. */ -void *virHashSteal(virHashTablePtr table, const void *name); +void *virHashSteal(virHashTablePtr table, const char *name); void *virHashAtomicSteal(virHashAtomicPtr table, - const void *name); + const char *name); /* * Get the hash table's key/value pairs and have them optionally sorted. @@ -193,6 +193,6 @@ bool virHashEqual(const virHashTable *table1, int virHashForEach(virHashTablePtr table, virHashIterator iter, void *data); ssize_t virHashRemoveSet(virHashTablePtr table, virHashSearcher iter, const void *data); void *virHashSearch(const virHashTable *table, virHashSearcher iter, - const void *data, void **name); + const void *data, char **name); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virHashTable, virHashFree); diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 30d6a19d1d..2731d46dfc 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -683,7 +683,7 @@ struct virLockSpaceRemoveData { static int virLockSpaceRemoveResourcesForOwner(const void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, const void *opaque) { virLockSpaceResourcePtr res = (virLockSpaceResourcePtr)payload; diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c index 94e73f3530..2d203e72af 100644 --- a/src/util/virmacmap.c +++ b/src/util/virmacmap.c @@ -52,7 +52,7 @@ static virClassPtr virMacMapClass; static int virMacMapHashFree(void *payload, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { g_strfreev(payload); @@ -197,7 +197,7 @@ virMacMapLoadFile(virMacMapPtr mgr, static int virMACMapHashDumper(void *payload, - const void *name, + const char *name, void *data) { virJSONValuePtr obj = virJSONValueNewObject(); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index da7fd4625a..61935134af 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2732,7 +2732,7 @@ testQemuMonitorCPUInfo(const void *opaque) static int testBlockNodeNameDetectFormat(void *payload, - const void *name, + const char *name, void *opaque) { qemuBlockNodeNameBackingChainDataPtr entry = payload; diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c index 839be55665..543a5f7f3f 100644 --- a/tests/qemusecuritymock.c +++ b/tests/qemusecuritymock.c @@ -381,7 +381,7 @@ struct _checkOwnerData { static int checkOwner(void *payload, - const void *name, + const char *name, void *opaque) { checkOwnerData *data = opaque; @@ -392,7 +392,7 @@ checkOwner(void *payload, !virStringListHasString(data->paths, name)) { fprintf(stderr, "Path %s wasn't restored back to its original owner\n", - (const char *) name); + name); data->chown_fail = true; } @@ -402,7 +402,7 @@ checkOwner(void *payload, static int printXATTR(void *payload, - const void *name, + const char *name, void *data) { bool *xattr_fail = data; @@ -413,7 +413,7 @@ printXATTR(void *payload, /* Hash table key consists of "$path:$xattr_name", xattr * value is then the value stored in the hash table. */ - printf("key=%s val=%s\n", (const char *) name, (const char *) payload); + printf("key=%s val=%s\n", name, (const char *) payload); return 0; } diff --git a/tests/virhashtest.c b/tests/virhashtest.c index 0ba5b9ed31..ad50aae003 100644 --- a/tests/virhashtest.c +++ b/tests/virhashtest.c @@ -46,7 +46,7 @@ testHashInit(void) static int testHashCheckForEachCount(void *payload G_GNUC_UNUSED, - const void *name G_GNUC_UNUSED, + const char *name G_GNUC_UNUSED, void *data G_GNUC_UNUSED) { size_t *count = data; @@ -175,7 +175,7 @@ const int testHashCountRemoveForEachSome = static int testHashRemoveForEachSome(void *payload G_GNUC_UNUSED, - const void *name, + const char *name, void *data) { virHashTablePtr hash = data; @@ -198,7 +198,7 @@ const int testHashCountRemoveForEachAll = 0; static int testHashRemoveForEachAll(void *payload G_GNUC_UNUSED, - const void *name, + const char *name, void *data) { virHashTablePtr hash = data; @@ -266,7 +266,7 @@ testHashSteal(const void *data G_GNUC_UNUSED) static int testHashRemoveSetIter(const void *payload G_GNUC_UNUSED, - const void *name, + const char *name, const void *data) { int *count = (int *) data; @@ -326,7 +326,7 @@ const int testSearchIndex = G_N_ELEMENTS(uuids_subset) / 2; static int testHashSearchIter(const void *payload G_GNUC_UNUSED, - const void *name, + const char *name, const void *data G_GNUC_UNUSED) { return STREQ(uuids_subset[testSearchIndex], name); -- 2.26.2