From e3960f4b6d0b6d8cb8b2631f8358abf289c1cc18 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 17 Feb 2020 12:36:59 +0100 Subject: [PATCH] virStorageFileGetMetadataRecurse: Use virHashHasEntry instead of fake pointers Replacing virHashLookup by virHashHasEntry allows us to use NULL as the payload of the hash table rather than putting a fake '1' pointer into the table. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/util/virstoragefile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index cf37744d6f..bb3fa65a14 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4992,14 +4992,14 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src, if (!(uniqueName = virStorageFileGetUniqueIdentifier(src))) goto cleanup; - if (virHashLookup(cycle, uniqueName)) { + if (virHashHasEntry(cycle, uniqueName)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("backing store for %s (%s) is self-referential"), NULLSTR(src->path), uniqueName); goto cleanup; } - if (virHashAddEntry(cycle, uniqueName, (void *)1) < 0) + if (virHashAddEntry(cycle, uniqueName, NULL) < 0) goto cleanup; if ((headerLen = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER, -- 2.47.2