D-Bus 1.13.18

Data Structures | Macros | Typedefs | Enumerations | Functions
Hash table
D-Bus secret internal implementation details

DBusHashTable data structure. More...

## Data Structures
struct | DBusHashIter
| Hash iterator object. More...

## Macros
#define | DBUS_HASH_POLLABLE DBUS_HASH_INT

## Typedefs
typedef int(* | KeyCompareFunc) (const void *key_a, const void *key_b)
| Key comparison function.
typedef struct DBusHashTable | DBusHashTable
typedef struct DBusHashIter | DBusHashIter
typedef struct DBusPreallocatedHash | DBusPreallocatedHash
| A preallocated hash entry.

## Enumerations
enum | DBusHashType { DBUS_HASH_STRING, DBUS_HASH_INT, DBUS_HASH_UINTPTR }

## Functions
DBusHashTable * | _dbus_hash_table_new (DBusHashType type, DBusFreeFunction key_free_function, DBusFreeFunction value_free_function)
| Constructs a new hash table. More...
DBusHashTable * | _dbus_hash_table_ref (DBusHashTable *table)
| Increments the reference count for a hash table. More...
void | _dbus_hash_table_unref (DBusHashTable *table)
| Decrements the reference count for a hash table, freeing the hash table if the count reaches zero. More...
void | _dbus_hash_table_remove_all (DBusHashTable *table)
| Removed all entries from a hash table. More...
void | _dbus_hash_iter_init (DBusHashTable *table, DBusHashIter *iter)
| Initializes a hash table iterator. More...
dbus_bool_t | _dbus_hash_iter_next (DBusHashIter *iter)
| Move the hash iterator forward one step, to the next hash entry. More...
void | _dbus_hash_iter_remove_entry (DBusHashIter *iter)
| Removes the current entry from the hash table. More...
void * | _dbus_hash_iter_get_value (DBusHashIter *iter)
| Gets the value of the current entry. More...
void | _dbus_hash_iter_set_value (DBusHashIter *iter, void *value)
| Sets the value of the current entry. More...
int | _dbus_hash_iter_get_int_key (DBusHashIter *iter)
| Gets the key for the current entry. More...
uintptr_t | _dbus_hash_iter_get_uintptr_key (DBusHashIter *iter)
| Gets the key for the current entry. More...
const char * | _dbus_hash_iter_get_string_key (DBusHashIter *iter)
| Gets the key for the current entry. More...
dbus_bool_t | _dbus_hash_iter_lookup (DBusHashTable *table, void *key, dbus_bool_t create_if_not_found, DBusHashIter *iter)
| A low-level but efficient interface for manipulating the hash table. More...
void * | _dbus_hash_table_lookup_string (DBusHashTable *table, const char *key)
| Looks up the value for a given string in a hash table of type DBUS_HASH_STRING. More...
void * | _dbus_hash_table_lookup_int (DBusHashTable *table, int key)
| Looks up the value for a given integer in a hash table of type DBUS_HASH_INT. More...
void * | _dbus_hash_table_lookup_uintptr (DBusHashTable *table, uintptr_t key)
| Looks up the value for a given integer in a hash table of type DBUS_HASH_UINTPTR. More...
dbus_bool_t | _dbus_hash_table_remove_string (DBusHashTable *table, const char *key)
| Removes the hash entry for the given key. More...
dbus_bool_t | _dbus_hash_table_remove_int (DBusHashTable *table, int key)
| Removes the hash entry for the given key. More...
dbus_bool_t | _dbus_hash_table_remove_uintptr (DBusHashTable *table, uintptr_t key)
| Removes the hash entry for the given key. More...
dbus_bool_t | _dbus_hash_table_insert_string (DBusHashTable *table, char *key, void *value)
| Creates a hash entry with the given key and value. More...
dbus_bool_t | _dbus_hash_table_insert_int (DBusHashTable *table, int key, void *value)
| Creates a hash entry with the given key and value. More...
dbus_bool_t | _dbus_hash_table_insert_uintptr (DBusHashTable *table, uintptr_t key, void *value)
| Creates a hash entry with the given key and value. More...
DBusPreallocatedHash * | _dbus_hash_table_preallocate_entry (DBusHashTable *table)
| Preallocate an opaque data blob that allows us to insert into the hash table at a later time without allocating any memory. More...
void | _dbus_hash_table_free_preallocated_entry (DBusHashTable *table, DBusPreallocatedHash *preallocated)
| Frees an opaque DBusPreallocatedHash that was not used in order to insert into the hash table. More...
void | _dbus_hash_table_insert_string_preallocated (DBusHashTable *table, DBusPreallocatedHash *preallocated, char *key, void *value)
| Inserts a string-keyed entry into the hash table, using a preallocated data block from _dbus_hash_table_preallocate_entry(). More...
int | _dbus_hash_table_get_n_entries (DBusHashTable *table)
| Gets the number of hash entries in a hash table. More...
dbus_bool_t | _dbus_hash_table_from_array (DBusHashTable *table, char **array, char delimiter)
| Imports a string array into a hash table The hash table needs to be initialized with string keys, and dbus_free() as both key and value free-function. More...
char ** | _dbus_hash_table_to_array (DBusHashTable *table, char delimiter)
| Creates a string array from a hash table. More...

## Detailed Description

DBusHashTable data structure.

Types and functions related to DBusHashTable.

## Typedef Documentation

## ◆ DBusHashIter

DBusHashIter

Public opaque hash table iterator object.

Definition at line 1 of file dbus-hash.h.

## ◆ DBusHashTable

DBusHashTable

Public opaque hash table object.

Definition at line 1 of file dbus-hash.h.

## Enumeration Type Documentation

## ◆ DBusHashType

enum DBusHashType

Indicates the type of a key in the hash table.

Enumerator
DBUS_HASH_STRING | Hash keys are strings.
DBUS_HASH_INT | Hash keys are integers.
DBUS_HASH_UINTPTR | Hash keys are integer capable to hold a pointer.

Definition at line 67 of file dbus-hash.h.

## Function Documentation

## ◆ _dbus_hash_iter_get_int_key()

DBUS_PRIVATE_EXPORT int _dbus_hash_iter_get_int_key | ( | DBusHashIter * | iter | ) |

Gets the key for the current entry.

Only works for hash tables of type DBUS_HASH_INT.

Parameters

  iter | the hash table iterator.

Definition at line 665 of file dbus-hash.c.

References _dbus_assert, _DBUS_POINTER_TO_INT, DBusRealHashIter::entry, DBusHashEntry::key, NULL, and DBusRealHashIter::table.

## ◆ _dbus_hash_iter_get_string_key()

DBUS_PRIVATE_EXPORT const char * _dbus_hash_iter_get_string_key | ( | DBusHashIter * | iter | ) |

Gets the key for the current entry.

Only works for hash tables of type DBUS_HASH_STRING

Parameters

  iter | the hash table iterator.

Definition at line 702 of file dbus-hash.c.

References _dbus_assert, DBusRealHashIter::entry, DBusHashEntry::key, NULL, and DBusRealHashIter::table.

Referenced by _dbus_hash_table_to_array().

## ◆ _dbus_hash_iter_get_uintptr_key()

DBUS_PRIVATE_EXPORT uintptr_t _dbus_hash_iter_get_uintptr_key | ( | DBusHashIter * | iter | ) |

Gets the key for the current entry.

Only works for hash tables of type DBUS_HASH_UINTPTR.

Parameters

  iter | the hash table iterator.

Definition at line 684 of file dbus-hash.c.

References _dbus_assert, DBusRealHashIter::entry, DBusHashEntry::key, NULL, and DBusRealHashIter::table.

## ◆ _dbus_hash_iter_get_value()

DBUS_PRIVATE_EXPORT void * _dbus_hash_iter_get_value | ( | DBusHashIter * | iter | ) |

Gets the value of the current entry.

Parameters

  iter | the hash table iterator.

Definition at line 619 of file dbus-hash.c.

References _dbus_assert, DBusRealHashIter::entry, NULL, DBusRealHashIter::table, and DBusHashEntry::value.

Referenced by _dbus_hash_table_to_array().

## ◆ _dbus_hash_iter_init()

DBUS_PRIVATE_EXPORT void _dbus_hash_iter_init | ( | DBusHashTable * | table,
|  | DBusHashIter * | iter
| ) |  |

Initializes a hash table iterator.

To iterate over all entries in a hash table, use the following code (the printf assumes a hash from strings to strings obviously):

DBusHashIter iter;
_dbus_hash_iter_init (table, &iter);
while (_dbus_hash_iter_next (&iter))
{
printf ("The first key is %s and value is %s\n",
_dbus_hash_iter_get_string_key (&iter),
_dbus_hash_iter_get_value (&iter));
}

The iterator is initialized pointing "one before" the first hash entry. The first call to _dbus_hash_iter_next() moves it onto the first valid entry or returns FALSE if the hash table is empty. Subsequent calls move to the next valid entry or return FALSE if there are no more entries.

Note that it is guaranteed to be safe to remove a hash entry during iteration, but it is not safe to add a hash entry.

Parameters

  table | the hash table to iterate over.
  iter | the iterator to initialize.

Definition at line 523 of file dbus-hash.c.

Referenced by _dbus_hash_table_remove_all(), and _dbus_hash_table_to_array().

## ◆ _dbus_hash_iter_lookup()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_iter_lookup | ( | DBusHashTable * | table,
|  | void * | key,
|  | dbus_bool_t | create_if_not_found,
|  | DBusHashIter * | iter
| ) |  |

A low-level but efficient interface for manipulating the hash table.

It's efficient because you can get, set, and optionally create the hash entry while only running the hash function one time.

Note that while calling _dbus_hash_iter_next() on the iterator filled in by this function may work, it's completely undefined which entries are after this iter and which are before it. So it would be silly to iterate using this iterator.

If the hash entry is created, its value will be initialized to all bits zero.

FALSE may be returned due to memory allocation failure, or because create_if_not_found was FALSE and the entry did not exist.

If create_if_not_found is TRUE, the hash table takes ownership of the key that's passed in (either using it to create the entry, or freeing it immediately).

For a hash table of type DBUS_HASH_INT, cast the int key to the key parameter using _DBUS_INT_TO_POINTER().

Parameters

  table | the hash table.
  key | the hash key.
  create_if_not_found | if TRUE, create the entry if it didn't exist.
  iter | the iterator to initialize.

Returns
  TRUE if the hash entry now exists (and the iterator is thus valid).

Definition at line 747 of file dbus-hash.c.

References NULL.

## ◆ _dbus_hash_iter_next()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_iter_next | ( | DBusHashIter * | iter | ) |

Move the hash iterator forward one step, to the next hash entry.

The documentation for _dbus_hash_iter_init() explains in more detail.

Parameters

  iter | the iterator to move forward.

Returns
  FALSE if there are no more entries to move to.

Definition at line 549 of file dbus-hash.c.

Referenced by _dbus_hash_table_remove_all(), and _dbus_hash_table_to_array().

## ◆ _dbus_hash_iter_remove_entry()

DBUS_PRIVATE_EXPORT void _dbus_hash_iter_remove_entry | ( | DBusHashIter * | iter | ) |

Removes the current entry from the hash table.

If a key_free_function or value_free_function was provided to _dbus_hash_table_new(), frees the key and/or value for this entry.

Parameters

  iter | the hash table iterator.

Definition at line 598 of file dbus-hash.c.

References _dbus_assert, DBusRealHashIter::bucket, DBusRealHashIter::entry, NULL, and DBusRealHashIter::table.

Referenced by _dbus_hash_table_remove_all().

## ◆ _dbus_hash_iter_set_value()

DBUS_PRIVATE_EXPORT void _dbus_hash_iter_set_value | ( | DBusHashIter * | iter,
|  | void * | value
| ) |  |

Sets the value of the current entry.

If the hash table has a value_free_function it will be used to free the previous value. The hash table will own the passed-in value (it will not be copied).

Parameters

  iter | the hash table iterator.
  value | the new value.

Definition at line 642 of file dbus-hash.c.

References _dbus_assert, DBusRealHashIter::entry, free_value_function, NULL, DBusRealHashIter::table, and DBusHashEntry::value.

## ◆ _dbus_hash_table_free_preallocated_entry()

DBUS_PRIVATE_EXPORT void _dbus_hash_table_free_preallocated_entry | ( | DBusHashTable * | table,
|  | DBusPreallocatedHash * | preallocated
| ) |  |

Frees an opaque DBusPreallocatedHash that was not used in order to insert into the hash table.

Parameters

  table | the hash table
  preallocated | the preallocated data

Definition at line 1402 of file dbus-hash.c.

References _dbus_assert, _dbus_mem_pool_dealloc(), entry_pool, and NULL.

## ◆ _dbus_hash_table_from_array()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_from_array | ( | DBusHashTable * | table,
|  | char ** | array,
|  | char | delimiter
| ) |  |

Imports a string array into a hash table The hash table needs to be initialized with string keys, and dbus_free() as both key and value free-function.

Parameters

  table | the hash table
  array | the string array to import
  delimiter | the delimiter to separate key and value

Returns
  TRUE on success.
  FALSE if not enough memory.

Definition at line 1478 of file dbus-hash.c.

References _dbus_assert, _dbus_hash_table_insert_string(), _dbus_string_append(), _dbus_string_free(), _dbus_string_init(), _dbus_string_set_length(), _dbus_string_split_on_byte(), _dbus_string_steal_data(), FALSE, NULL, and TRUE.

## ◆ _dbus_hash_table_get_n_entries()

DBUS_PRIVATE_EXPORT int _dbus_hash_table_get_n_entries | ( | DBusHashTable * | table | ) |

Gets the number of hash entries in a hash table.

Parameters

  table | the hash table.

Returns
  the number of entries in the table.

Definition at line 1460 of file dbus-hash.c.

References n_entries.

Referenced by _dbus_hash_table_to_array().

## ◆ _dbus_hash_table_insert_int()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_insert_int | ( | DBusHashTable * | table,
|  | int | key,
|  | void * | value
| ) |  |

Creates a hash entry with the given key and value.

The key and value are not copied; they are stored in the hash table by reference. If an entry with the given key already exists, the previous key and value are overwritten (and freed if the hash table has a key_free_function and/or value_free_function).

Returns FALSE if memory for the new hash entry can't be allocated.

Parameters

  table | the hash table.
  key | the hash entry key.
  value | the hash entry value.

Definition at line 1311 of file dbus-hash.c.

References _dbus_assert, _DBUS_INT_TO_POINTER, DBUS_HASH_INT, FALSE, find_function, free_key_function, free_value_function, DBusHashEntry::key, key_type, NULL, TRUE, and DBusHashEntry::value.

## ◆ _dbus_hash_table_insert_string()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_insert_string | ( | DBusHashTable * | table,
|  | char * | key,
|  | void * | value
| ) |  |

Creates a hash entry with the given key and value.

The key and value are not copied; they are stored in the hash table by reference. If an entry with the given key already exists, the previous key and value are overwritten (and freed if the hash table has a key_free_function and/or value_free_function).

Returns FALSE if memory for the new hash entry can't be allocated.

Parameters

  table | the hash table.
  key | the hash entry key.
  value | the hash entry value.

Definition at line 1277 of file dbus-hash.c.

References _dbus_assert, _dbus_hash_table_insert_string_preallocated(), _dbus_hash_table_preallocate_entry(), DBUS_HASH_STRING, FALSE, key_type, NULL, and TRUE.

Referenced by _dbus_hash_table_from_array().

## ◆ _dbus_hash_table_insert_string_preallocated()

DBUS_PRIVATE_EXPORT void _dbus_hash_table_insert_string_preallocated | ( | DBusHashTable * | table,
|  | DBusPreallocatedHash * | preallocated,
|  | char * | key,
|  | void * | value
| ) |  |

Inserts a string-keyed entry into the hash table, using a preallocated data block from _dbus_hash_table_preallocate_entry().

This function cannot fail due to lack of memory. The DBusPreallocatedHash object is consumed and should not be reused or freed. Otherwise this function works just like _dbus_hash_table_insert_string().

Parameters

  table | the hash table
  preallocated | the preallocated data
  key | the hash key
  value | the value

Definition at line 1429 of file dbus-hash.c.

References _dbus_assert, DBUS_HASH_STRING, find_function, free_key_function, free_value_function, DBusHashEntry::key, key_type, NULL, TRUE, and DBusHashEntry::value.

Referenced by _dbus_hash_table_insert_string().

## ◆ _dbus_hash_table_insert_uintptr()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_insert_uintptr | ( | DBusHashTable * | table,
|  | uintptr_t | key,
|  | void * | value
| ) |  |

Creates a hash entry with the given key and value.

The key and value are not copied; they are stored in the hash table by reference. If an entry with the given key already exists, the previous key and value are overwritten (and freed if the hash table has a key_free_function and/or value_free_function).

Returns FALSE if memory for the new hash entry can't be allocated.

Parameters

  table | the hash table.
  key | the hash entry key.
  value | the hash entry value.

Definition at line 1352 of file dbus-hash.c.

References _dbus_assert, DBUS_HASH_UINTPTR, FALSE, find_function, free_key_function, free_value_function, DBusHashEntry::key, key_type, NULL, TRUE, and DBusHashEntry::value.

Referenced by _dbus_user_database_lookup(), and _dbus_user_database_lookup_group().

## ◆ _dbus_hash_table_lookup_int()

DBUS_PRIVATE_EXPORT void * _dbus_hash_table_lookup_int | ( | DBusHashTable * | table,
|  | int | key
| ) |  |

Looks up the value for a given integer in a hash table of type DBUS_HASH_INT.

Returns NULL if the value is not present. (A not-present entry is indistinguishable from an entry with a value of NULL.)

Parameters

  table | the hash table.
  key | the integer to look up.

Returns
  the value of the hash entry.

Definition at line 1137 of file dbus-hash.c.

References _dbus_assert, _DBUS_INT_TO_POINTER, DBUS_HASH_INT, FALSE, find_function, key_type, NULL, and DBusHashEntry::value.

Referenced by _dbus_connection_queue_received_message_link().

## ◆ _dbus_hash_table_lookup_string()

DBUS_PRIVATE_EXPORT void * _dbus_hash_table_lookup_string | ( | DBusHashTable * | table,
|  | const char * | key
| ) |  |

Looks up the value for a given string in a hash table of type DBUS_HASH_STRING.

Returns NULL if the value is not present. (A not-present entry is indistinguishable from an entry with a value of NULL.)

Parameters

  table | the hash table.
  key | the string to look up.

Returns
  the value of the hash entry.

Definition at line 1112 of file dbus-hash.c.

References _dbus_assert, DBUS_HASH_STRING, FALSE, find_function, key_type, NULL, and DBusHashEntry::value.

Referenced by _dbus_user_database_lookup(), and _dbus_user_database_lookup_group().

## ◆ _dbus_hash_table_lookup_uintptr()

DBUS_PRIVATE_EXPORT void * _dbus_hash_table_lookup_uintptr | ( | DBusHashTable * | table,
|  | uintptr_t | key
| ) |  |

Looks up the value for a given integer in a hash table of type DBUS_HASH_UINTPTR.

Returns NULL if the value is not present. (A not-present entry is indistinguishable from an entry with a value of NULL.)

Parameters

  table | the hash table.
  key | the integer to look up.

Returns
  the value of the hash entry.

Definition at line 1162 of file dbus-hash.c.

References _dbus_assert, DBUS_HASH_UINTPTR, FALSE, find_function, key_type, NULL, and DBusHashEntry::value.

Referenced by _dbus_user_database_lookup(), and _dbus_user_database_lookup_group().

## ◆ _dbus_hash_table_new()

DBUS_PRIVATE_EXPORT DBusHashTable * _dbus_hash_table_new | ( | DBusHashType | type,
|  | DBusFreeFunction | key_free_function,
|  | DBusFreeFunction | value_free_function
| ) |  |

Constructs a new hash table.

Should be freed with _dbus_hash_table_unref(). If memory cannot be allocated for the hash table, returns NULL.

Parameters

  type | the type of hash key to use.
  key_free_function | function to free hash keys.
  value_free_function | function to free hash values.

Returns
  a new DBusHashTable or NULL if no memory.

Definition at line 291 of file dbus-hash.c.

References _dbus_assert, _dbus_mem_pool_new(), _DBUS_N_ELEMENTS, buckets, dbus_free(), DBUS_HASH_INT, DBUS_HASH_UINTPTR, dbus_new0, DBUS_SMALL_HASH_TABLE, down_shift, entry_pool, find_function, hi_rebuild_size, key_type, lo_rebuild_size, mask, n_buckets, n_entries, NULL, REBUILD_MULTIPLIER, refcount, static_buckets, and TRUE.

Referenced by _dbus_connection_new_for_transport(), and _dbus_user_database_new().

## ◆ _dbus_hash_table_preallocate_entry()

DBUS_PRIVATE_EXPORT DBusPreallocatedHash * _dbus_hash_table_preallocate_entry | ( | DBusHashTable * | table | ) |

Preallocate an opaque data blob that allows us to insert into the hash table at a later time without allocating any memory.

Parameters

  table | the hash table

Returns
  the preallocated data, or NULL if no memory

Definition at line 1385 of file dbus-hash.c.

Referenced by _dbus_hash_table_insert_string().

## ◆ _dbus_hash_table_ref()

DBUS_PRIVATE_EXPORT DBusHashTable * _dbus_hash_table_ref | ( | DBusHashTable * | table | ) |

Increments the reference count for a hash table.

Parameters

  table | the hash table to add a reference to.

Returns
  the hash table.

Definition at line 353 of file dbus-hash.c.

References refcount.

## ◆ _dbus_hash_table_remove_all()

void _dbus_hash_table_remove_all | ( | DBusHashTable * | table | ) |

Removed all entries from a hash table.

Parameters

  table | the hash table to remove all entries from.

Definition at line 424 of file dbus-hash.c.

References _dbus_hash_iter_init(), _dbus_hash_iter_next(), and _dbus_hash_iter_remove_entry().

Referenced by _dbus_user_database_flush().

## ◆ _dbus_hash_table_remove_int()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_remove_int | ( | DBusHashTable * | table,
|  | int | key
| ) |  |

Removes the hash entry for the given key.

If no hash entry for the key exists, does nothing.

Parameters

  table | the hash table.
  key | the hash key.

Returns
  TRUE if the entry existed

Definition at line 1214 of file dbus-hash.c.

References _dbus_assert, _DBUS_INT_TO_POINTER, DBUS_HASH_INT, FALSE, find_function, key_type, and NULL.

## ◆ _dbus_hash_table_remove_string()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_remove_string | ( | DBusHashTable * | table,
|  | const char * | key
| ) |  |

Removes the hash entry for the given key.

If no hash entry for the key exists, does nothing.

Parameters

  table | the hash table.
  key | the hash key.

Returns
  TRUE if the entry existed

Definition at line 1186 of file dbus-hash.c.

References _dbus_assert, DBUS_HASH_STRING, FALSE, find_function, key_type, and NULL.

## ◆ _dbus_hash_table_remove_uintptr()

DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_remove_uintptr | ( | DBusHashTable * | table,
|  | uintptr_t | key
| ) |  |

Removes the hash entry for the given key.

If no hash entry for the key exists, does nothing.

Parameters

  table | the hash table.
  key | the hash key.

Returns
  TRUE if the entry existed

Definition at line 1242 of file dbus-hash.c.

References _dbus_assert, DBUS_HASH_UINTPTR, FALSE, find_function, key_type, and NULL.

## ◆ _dbus_hash_table_to_array()

DBUS_PRIVATE_EXPORT char ** _dbus_hash_table_to_array | ( | DBusHashTable * | table,
|  | char | delimiter
| ) |  |

Creates a string array from a hash table.

Parameters

  table | the hash table
  delimiter | the delimiter to join key and value

Returns
  pointer to created string array (free with dbus_free_string_array)
  FALSE if not enough memory.

Definition at line 1543 of file dbus-hash.c.

References _dbus_assert, _dbus_hash_iter_get_string_key(), _dbus_hash_iter_get_value(), _dbus_hash_iter_init(), _dbus_hash_iter_next(), _dbus_hash_table_get_n_entries(), _dbus_string_append_printf(), _dbus_string_free(), _dbus_string_init(), _dbus_string_steal_data(), dbus_free_string_array(), dbus_new0, and NULL.

## ◆ _dbus_hash_table_unref()

DBUS_PRIVATE_EXPORT void _dbus_hash_table_unref | ( | DBusHashTable * | table | ) |

Decrements the reference count for a hash table, freeing the hash table if the count reaches zero.

Parameters

  table | the hash table to remove a reference from.

Definition at line 367 of file dbus-hash.c.

References buckets, n_buckets, DBusHashEntry::next, NULL, and refcount.

Referenced by _dbus_user_database_unref().

DBusHashIter
Hash iterator object.
Definition: dbus-hash.h:50
_dbus_hash_iter_next
dbus_bool_t _dbus_hash_iter_next(DBusHashIter *iter)
Move the hash iterator forward one step, to the next hash entry.
Definition: dbus-hash.c:549
_dbus_hash_iter_get_string_key
const char * _dbus_hash_iter_get_string_key(DBusHashIter *iter)
Gets the key for the current entry.
Definition: dbus-hash.c:702
_dbus_hash_iter_get_value
void * _dbus_hash_iter_get_value(DBusHashIter *iter)
Gets the value of the current entry.
Definition: dbus-hash.c:619
_dbus_hash_iter_init
void _dbus_hash_iter_init(DBusHashTable *table, DBusHashIter *iter)
Initializes a hash table iterator.
Definition: dbus-hash.c:523