util: hash: Change type of hash table name/key to 'char'

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@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2020-10-21 13:31:16 +02:00
parent a2c699856a
commit d6d4c08daf
31 changed files with 129 additions and 129 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -246,7 +246,7 @@ struct virCloseCallbacksData {
static int
virCloseCallbacksGetOne(void *payload,
const void *key,
const char *key,
void *opaque)
{
struct virCloseCallbacksData *data = opaque;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -638,7 +638,7 @@ struct _virQEMUMomentRemove {
};
int qemuDomainMomentDiscardAll(void *payload,
const void *name,
const char *name,
void *data);
int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,

View File

@ -8067,7 +8067,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver,
static int
qemuProcessRefreshLegacyBlockjob(void *payload,
const void *name,
const char *name,
void *opaque)
{
const char *jobname = name;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -2732,7 +2732,7 @@ testQemuMonitorCPUInfo(const void *opaque)
static int
testBlockNodeNameDetectFormat(void *payload,
const void *name,
const char *name,
void *opaque)
{
qemuBlockNodeNameBackingChainDataPtr entry = payload;

View File

@ -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;
}

View File

@ -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);