aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/slice/slice_hash_table.h
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-05-05 17:52:01 +0000
committerGravatar Craig Tiller <ctiller@google.com>2017-05-05 17:52:01 +0000
commita37ad7d1345e48dff8a60b92af384b99086f6ae6 (patch)
treec4bc7feef08271ec06e95511c51d5f3fcc1674c8 /src/core/lib/slice/slice_hash_table.h
parent9247817082bc5d33ebe048a1aa0c5881fdb408ed (diff)
parent0994bbd0f7d8e97ca946ee97f24643d79e5d2c3e (diff)
Merge branch 'trickle_stall' of github.com:ctiller/grpc into trickle_stall
Diffstat (limited to 'src/core/lib/slice/slice_hash_table.h')
-rw-r--r--src/core/lib/slice/slice_hash_table.h19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/core/lib/slice/slice_hash_table.h b/src/core/lib/slice/slice_hash_table.h
index d0c27122d7..1e61c5eb11 100644
--- a/src/core/lib/slice/slice_hash_table.h
+++ b/src/core/lib/slice/slice_hash_table.h
@@ -37,33 +37,28 @@
/** Hash table implementation.
*
* This implementation uses open addressing
- * (https://en.wikipedia.org/wiki/Open_addressing) with quadratic
- * probing (https://en.wikipedia.org/wiki/Quadratic_probing).
+ * (https://en.wikipedia.org/wiki/Open_addressing) with linear
+ * probing (https://en.wikipedia.org/wiki/Linear_probing).
*
* The keys are \a grpc_slice objects. The values are arbitrary pointers
- * with a common vtable.
+ * with a common destroy function.
*
* Hash tables are intentionally immutable, to avoid the need for locking.
*/
typedef struct grpc_slice_hash_table grpc_slice_hash_table;
-typedef struct grpc_slice_hash_table_vtable {
- void (*destroy_value)(grpc_exec_ctx *exec_ctx, void *value);
- void *(*copy_value)(void *value);
-} grpc_slice_hash_table_vtable;
-
typedef struct grpc_slice_hash_table_entry {
grpc_slice key;
void *value; /* Must not be NULL. */
- const grpc_slice_hash_table_vtable *vtable;
} grpc_slice_hash_table_entry;
/** Creates a new hash table of containing \a entries, which is an array
- of length \a num_entries.
- Creates its own copy of all keys and values from \a entries. */
+ of length \a num_entries. Takes ownership of all keys and values in
+ \a entries. Values will be cleaned up via \a destroy_value(). */
grpc_slice_hash_table *grpc_slice_hash_table_create(
- size_t num_entries, grpc_slice_hash_table_entry *entries);
+ size_t num_entries, grpc_slice_hash_table_entry *entries,
+ void (*destroy_value)(grpc_exec_ctx *exec_ctx, void *value));
grpc_slice_hash_table *grpc_slice_hash_table_ref(grpc_slice_hash_table *table);
void grpc_slice_hash_table_unref(grpc_exec_ctx *exec_ctx,