aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/slice
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-11-18 14:52:25 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-11-18 14:52:25 -0800
commit9ecadce1e089901ca0c9317f7d8f6d41689f8f61 (patch)
tree0aa86811cbf33bc53ce7cfb6216e04e3a14562fd /src/core/lib/slice
parenta8b66a6e02e76cec6acf1179a42e19920749c3be (diff)
Get identity law testing right
Diffstat (limited to 'src/core/lib/slice')
-rw-r--r--src/core/lib/slice/slice_intern.c5
-rw-r--r--src/core/lib/slice/slice_internal.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/core/lib/slice/slice_intern.c b/src/core/lib/slice/slice_intern.c
index 6f65a3dcc8..2d93284926 100644
--- a/src/core/lib/slice/slice_intern.c
+++ b/src/core/lib/slice/slice_intern.c
@@ -193,6 +193,11 @@ void grpc_slice_static_intern(grpc_slice *slice) {
}
}
+bool grpc_slice_is_interned(grpc_slice slice) {
+ return (slice.refcount && slice.refcount->vtable == &interned_slice_vtable) ||
+ grpc_is_static_metadata_string(slice);
+}
+
grpc_slice grpc_slice_intern(grpc_slice slice) {
if (grpc_is_static_metadata_string(slice)) {
return slice;
diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h
index 695bd308ad..211d5f06be 100644
--- a/src/core/lib/slice/slice_internal.h
+++ b/src/core/lib/slice/slice_internal.h
@@ -46,6 +46,9 @@ void grpc_slice_buffer_reset_and_unref_internal(grpc_exec_ctx *exec_ctx,
void grpc_slice_buffer_destroy_internal(grpc_exec_ctx *exec_ctx,
grpc_slice_buffer *sb);
+/* Check if a slice is interned */
+bool grpc_slice_is_interned(grpc_slice slice);
+
void grpc_slice_intern_init(void);
void grpc_slice_intern_shutdown(void);
void grpc_test_only_set_slice_hash_seed(uint32_t key);