diff options
author | Craig Tiller <ctiller@google.com> | 2016-11-23 08:22:41 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-11-23 08:22:41 -0800 |
commit | 1444596a6259d8be4f375b4a7fc50a6834a52ec3 (patch) | |
tree | 07d96e2c85dd68d990e0c9f743704fe22df6ff2c /src/core/lib/slice | |
parent | c09d784591d75f64256232d441ae90f6525dc1f9 (diff) |
Start sketching interning refcount, fix static
Diffstat (limited to 'src/core/lib/slice')
-rw-r--r-- | src/core/lib/slice/slice_intern.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/core/lib/slice/slice_intern.c b/src/core/lib/slice/slice_intern.c index 753bdccbe5..1e0e789e6c 100644 --- a/src/core/lib/slice/slice_intern.c +++ b/src/core/lib/slice/slice_intern.c @@ -53,6 +53,7 @@ typedef struct interned_slice_refcount { grpc_slice_refcount base; + grpc_slice_refcount sub; size_t length; gpr_atm refcnt; uint32_t hash; @@ -176,20 +177,11 @@ uint32_t grpc_slice_default_hash_impl(grpc_slice s) { } uint32_t grpc_static_slice_hash(grpc_slice s) { - int id = GRPC_STATIC_METADATA_INDEX(s); - if (id == -1) { - return grpc_slice_default_hash_impl(s); - } - return static_metadata_hash_values[id]; + return static_metadata_hash_values[GRPC_STATIC_METADATA_INDEX(s)]; } int grpc_static_slice_eq(grpc_slice a, grpc_slice b) { - int id_a = GRPC_STATIC_METADATA_INDEX(a); - int id_b = GRPC_STATIC_METADATA_INDEX(b); - if (id_a == -1 || id_b == -1) { - return grpc_slice_default_eq_impl(a, b); - } - return id_a == id_b; + return GRPC_STATIC_METADATA_INDEX(a) == GRPC_STATIC_METADATA_INDEX(b); } uint32_t grpc_slice_hash(grpc_slice s) { |