Admin Production ni-theme
Current Publication

HashTableRemoveItem

LabWindows/CVI

HashTableRemoveItem

int HashTableRemoveItem (HashTableType table, const void *key, void *value, size_t valueBufferSize);

Purpose

Removes a key-value pair from the table.

If there is no value associated with the key, HashTableRemoveItem returns 0 for the value parameter and returns success.

If removing the key-value pair decreases the load of the table below the shrink load of the table, LabWindows/CVI resizes the table to half its size.

Note Note   The table never shrinks below the size originally allocated by HashTableCreate. Resizing can be very slow because it requires rehashing all keys stored in the table.

Parameters

Input
Name Type Description
table HashTableType Hash table from which to remove the item.
key const void * Pointer to the first byte of the key data.
valueBufferSize size_t The size, in bytes, of the value buffer. valueBufferSize returns an error if the buffer is not large enough to hold the value. This parameter is ignored if the value buffer is NULL.
Output
Name Type Description
value void * A buffer or variable reference in which to store the value.

Pass NULL if you do not want the value.

Return Value

Name Type Description
status int Returns a value indicating if the function was successful.

A negative number means an error occurred.

For a detailed error message, pass the returned value to GetGeneralErrorString.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 8.5 and later

Example

Refer to toolbox\hashtable.cws for an example of using the HashTableRemoveItem function.