Skip to content
Snippets Groups Projects
Commit 624997a2 authored by Mark D. Roth's avatar Mark D. Roth
Browse files

Code review changes.

parent 070a2873
No related branches found
No related tags found
No related merge requests found
......@@ -64,8 +64,7 @@ static void grpc_hash_table_add(grpc_hash_table* table, grpc_mdstr* key,
GPR_ASSERT(value != NULL);
const size_t idx =
grpc_hash_table_find_index(table, key, true /* find_empty */);
// This can happen if the table is full.
GPR_ASSERT(idx != table->num_entries);
GPR_ASSERT(idx != table->num_entries); // Table should never be full.
grpc_hash_table_entry* entry = &table->entries[idx];
entry->key = GRPC_MDSTR_REF(key);
entry->value = vtable->copy_value(value);
......
......@@ -39,10 +39,8 @@
* This implementation uses open addressing
* (https://en.wikipedia.org/wiki/Open_addressing) with quadratic
* probing (https://en.wikipedia.org/wiki/Quadratic_probing).
* This means that the hash table is of fixed size and cannot contain
* more than that number of elements.
*
* The keys are grpc_mdstr objects. The values are arbitrary pointers
* The keys are \a grpc_mdstr objects. The values are arbitrary pointers
* with a common vtable.
*
* Hash tables are intentionally immutable, to avoid the need for locking.
......@@ -76,7 +74,8 @@ int grpc_hash_table_unref(grpc_hash_table* table);
Returns NULL if \a key is not found. */
void* grpc_hash_table_get(const grpc_hash_table* table, const grpc_mdstr* key);
/** Compares two hash tables. */
/** Compares two hash tables.
The sort order is stable but undefined. */
int grpc_hash_table_cmp(const grpc_hash_table* table1,
const grpc_hash_table* table2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment