diff options
author | 2016-11-21 13:46:31 -0800 | |
---|---|---|
committer | 2016-11-21 13:46:31 -0800 | |
commit | 3b05e1da916aa298fe58a58ec79a7f7c043534c7 (patch) | |
tree | 72353f42667b389f913e6a5164019199000eded7 /include | |
parent | 73ee7dc5590447bc726f7a1c3e51c2a217c8d5b6 (diff) |
Move from cmp --> eq, and provide a good implementation for interning
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/impl/codegen/slice.h | 3 | ||||
-rw-r--r-- | include/grpc/slice.h | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h index ecce1ca089..fbd18e6c65 100644 --- a/include/grpc/impl/codegen/slice.h +++ b/include/grpc/impl/codegen/slice.h @@ -57,7 +57,8 @@ typedef struct grpc_slice grpc_slice; typedef struct grpc_slice_refcount_vtable { void (*ref)(void *); void (*unref)(grpc_exec_ctx *exec_ctx, void *); - uint32_t (*hash)(void *, grpc_slice slice); + int (*eq)(grpc_slice a, grpc_slice b); + uint32_t (*hash)(grpc_slice slice); } grpc_slice_refcount_vtable; /* Reference count container for grpc_slice. Contains function pointers to diff --git a/include/grpc/slice.h b/include/grpc/slice.h index dc0a7a344e..73d1fa43ec 100644 --- a/include/grpc/slice.h +++ b/include/grpc/slice.h @@ -124,7 +124,10 @@ GPRAPI grpc_slice grpc_slice_split_head(grpc_slice *s, size_t split); GPRAPI grpc_slice grpc_empty_slice(void); -GPRAPI uint32_t grpc_slice_default_hash_impl(void *, grpc_slice s); +GPRAPI uint32_t grpc_slice_default_hash_impl(grpc_slice s); +GPRAPI int grpc_slice_default_eq_impl(grpc_slice a, grpc_slice b); + +GPRAPI int grpc_slice_eq(grpc_slice a, grpc_slice b); /* Returns <0 if a < b, ==0 if a == b, >0 if a > b The order is arbitrary, and is not guaranteed to be stable across different |