mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
Implement virHashRemoveAll function
Implement function to remove all entries of a hash table.
This commit is contained in:
parent
b83d76d40e
commit
6241eed3db
@ -578,6 +578,7 @@ virHashForEach;
|
||||
virHashFree;
|
||||
virHashGetItems;
|
||||
virHashLookup;
|
||||
virHashRemoveAll;
|
||||
virHashRemoveEntry;
|
||||
virHashRemoveSet;
|
||||
virHashSearch;
|
||||
|
@ -575,6 +575,31 @@ virHashRemoveSet(virHashTablePtr table,
|
||||
return count;
|
||||
}
|
||||
|
||||
static int
|
||||
_virHashRemoveAllIter(const void *payload ATTRIBUTE_UNUSED,
|
||||
const void *name ATTRIBUTE_UNUSED,
|
||||
const void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virHashRemoveAll
|
||||
* @table: the hash table to clear
|
||||
*
|
||||
* Free the hash @table's contents. The userdata is
|
||||
* deallocated with the function provided at creation time.
|
||||
*
|
||||
* Returns the number of items removed on success, -1 on failure
|
||||
*/
|
||||
ssize_t
|
||||
virHashRemoveAll(virHashTablePtr table)
|
||||
{
|
||||
return virHashRemoveSet(table,
|
||||
_virHashRemoveAllIter,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* virHashSearch:
|
||||
* @table: the hash table to search
|
||||
|
@ -126,6 +126,11 @@ int virHashUpdateEntry(virHashTablePtr table,
|
||||
int virHashRemoveEntry(virHashTablePtr table,
|
||||
const void *name);
|
||||
|
||||
/*
|
||||
* Remove all entries from the hash table.
|
||||
*/
|
||||
ssize_t virHashRemoveAll(virHashTablePtr table);
|
||||
|
||||
/*
|
||||
* Retrieve the userdata.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user