提交 e3960f4b 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 157b8722
...@@ -4992,14 +4992,14 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src, ...@@ -4992,14 +4992,14 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
if (!(uniqueName = virStorageFileGetUniqueIdentifier(src))) if (!(uniqueName = virStorageFileGetUniqueIdentifier(src)))
goto cleanup; goto cleanup;
if (virHashLookup(cycle, uniqueName)) { if (virHashHasEntry(cycle, uniqueName)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("backing store for %s (%s) is self-referential"), _("backing store for %s (%s) is self-referential"),
NULLSTR(src->path), uniqueName); NULLSTR(src->path), uniqueName);
goto cleanup; goto cleanup;
} }
if (virHashAddEntry(cycle, uniqueName, (void *)1) < 0) if (virHashAddEntry(cycle, uniqueName, NULL) < 0)
goto cleanup; goto cleanup;
if ((headerLen = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER, if ((headerLen = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册