]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virStorageFileGetMetadataRecurse: Use virHashHasEntry instead of fake pointers
authorPeter Krempa <pkrempa@redhat.com>
Mon, 17 Feb 2020 11:36:59 +0000 (12:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 Feb 2020 06:57:09 +0000 (07:57 +0100)
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 <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/util/virstoragefile.c

index cf37744d6f2b217e8e806c8f836b2cd9e903a300..bb3fa65a14ce4b2c88dfccd273f37b67c1dc042e 100644 (file)
@@ -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,