diff options
author | Havoc Pennington <hp@redhat.com> | 2003-08-18 22:43:30 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-08-18 22:43:30 +0000 |
commit | 68a3c593b9e77b33614726363c7b6fd85d113021 (patch) | |
tree | ec3035e33c20febc29d2b27e13139540dc739bbc /dbus/dbus-hash.c | |
parent | 95717a938b237d12211935f6a7467ef610288fe5 (diff) |
2003-08-18 Havoc Pennington <hp@redhat.com>
* dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix
* dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix
dumb bug created earlier (wrong order of args to
decode_header_data())
* tools/dbus-send.c: port
* tools/dbus-print-message.c (print_message): port
* test/data/*messages: port all messages over
* dbus/dbus-message-builder.c: support including
message type
* bus/driver.c: port over
* bus/dispatch.c: port over to new stuff
* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
rename disconnect signal to "Disconnected"
Diffstat (limited to 'dbus/dbus-hash.c')
-rw-r--r-- | dbus/dbus-hash.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/dbus/dbus-hash.c b/dbus/dbus-hash.c index f4547815..044dc534 100644 --- a/dbus/dbus-hash.c +++ b/dbus/dbus-hash.c @@ -1423,17 +1423,24 @@ _dbus_hash_table_insert_two_strings (DBusHashTable *table, char *key, void *value) { - DBusPreallocatedHash *preallocated; - + DBusHashEntry *entry; + _dbus_assert (table->key_type == DBUS_HASH_TWO_STRINGS); + + entry = (* table->find_function) (table, key, TRUE, NULL, NULL); - preallocated = _dbus_hash_table_preallocate_entry (table); - if (preallocated == NULL) - return FALSE; + if (entry == NULL) + return FALSE; /* no memory */ - _dbus_hash_table_insert_string_preallocated (table, preallocated, - key, value); + if (table->free_key_function && entry->key != key) + (* table->free_key_function) (entry->key); + + if (table->free_value_function && entry->value != value) + (* table->free_value_function) (entry->value); + entry->key = key; + entry->value = value; + return TRUE; } @@ -1811,8 +1818,8 @@ _dbus_hash_test (void) if (value == NULL) goto out; - if (!_dbus_hash_table_insert_string (table4, - key, value)) + if (!_dbus_hash_table_insert_two_strings (table4, + key, value)) goto out; _dbus_assert (count_entries (table1) == i + 1); @@ -1832,9 +1839,9 @@ _dbus_hash_test (void) _dbus_assert (value != NULL); _dbus_assert (strcmp (value, keys[i]) == 0); - value = _dbus_hash_table_lookup_ulong (table4, i); + value = _dbus_hash_table_lookup_two_strings (table4, keys[i]); _dbus_assert (value != NULL); - _dbus_assert (strcmp (value, keys[i]) == 0); + _dbus_assert (strcmp (value, "Value!") == 0); ++i; } |