diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 875ad8a7c7e451f6a6592c7a7edd7cb7849d58ee..ee8bb84041170eb9b7c6e7faec9b83b30c3f116c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2071,6 +2071,7 @@ virHashForEach; virHashFree; virHashGetItems; virHashLookup; +virHashNew; virHashRemoveAll; virHashRemoveEntry; virHashRemoveSet; diff --git a/src/util/virhash.c b/src/util/virhash.c index 32de4dabad0e9567b6f80ee15976b20699fb5dce..9384d28002028b26161275abe9ef40153bf9e15f 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -169,6 +169,27 @@ virHashTablePtr virHashCreateFull(ssize_t size, } +/** + * virHashNew: + * @dataFree: callback to free data + * + * Create a new virHashTablePtr. + * + * Returns the newly created object, or NULL if an error occurred. + */ +virHashTablePtr +virHashNew(virHashDataFreeSimple dataFree) +{ + return virHashCreateFull(32, + NULL, + dataFree, + virHashStrCode, + virHashStrEqual, + virHashStrCopy, + virHashStrFree); +} + + /** * virHashCreate: * @size: the size of the hash table diff --git a/src/util/virhash.h b/src/util/virhash.h index 94fe8e23e4957dc01e3d36d6c7c1a32eb6e643d8..d7de0618cb80687c7a4c90babee2f7e53469ada3 100644 --- a/src/util/virhash.h +++ b/src/util/virhash.h @@ -107,6 +107,7 @@ typedef void (*virHashKeyFree)(void *name); /* * Constructor and destructor. */ +virHashTablePtr virHashNew(virHashDataFreeSimple dataFree); virHashTablePtr virHashCreate(ssize_t size, virHashDataFree dataFree); virHashAtomicPtr virHashAtomicNew(ssize_t size,