aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/impl/codegen/slice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc/impl/codegen/slice.h')
-rw-r--r--include/grpc/impl/codegen/slice.h21
1 files changed, 4 insertions, 17 deletions
diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h
index 3c9c7b0285..00781bb76b 100644
--- a/include/grpc/impl/codegen/slice.h
+++ b/include/grpc/impl/codegen/slice.h
@@ -40,8 +40,6 @@
#include <grpc/impl/codegen/exec_ctx_fwd.h>
#include <grpc/impl/codegen/gpr_slice.h>
-typedef struct grpc_slice grpc_slice;
-
/* Slice API
A slice represents a contiguous reference counted array of bytes.
@@ -55,25 +53,14 @@ typedef struct grpc_slice grpc_slice;
reference ownership semantics (who should call unref?) and mutability
constraints (is the callee allowed to modify the slice?) */
-typedef struct grpc_slice_refcount_vtable {
- void (*ref)(void *);
- void (*unref)(grpc_exec_ctx *exec_ctx, void *);
- 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
increment and decrement reference counts. Implementations should cleanup
when the reference count drops to zero.
Typically client code should not touch this, and use grpc_slice_malloc,
grpc_slice_new, or grpc_slice_new_with_len instead. */
typedef struct grpc_slice_refcount {
- const grpc_slice_refcount_vtable *vtable;
- /* If a subset of this slice is taken, use this pointer for the refcount.
- Typically points back to the refcount itself, however iterning
- implementations can use this to avoid a verification step on each hash
- or equality check */
- struct grpc_slice_refcount *sub_refcount;
+ void (*ref)(void *);
+ void (*unref)(grpc_exec_ctx *exec_ctx, void *);
} grpc_slice_refcount;
#define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
@@ -87,7 +74,7 @@ typedef struct grpc_slice_refcount {
If the slice does not have a refcount, it represents an inlined small piece
of data that is copied by value. */
-struct grpc_slice {
+typedef struct grpc_slice {
struct grpc_slice_refcount *refcount;
union {
struct {
@@ -99,7 +86,7 @@ struct grpc_slice {
uint8_t bytes[GRPC_SLICE_INLINED_SIZE];
} inlined;
} data;
-};
+} grpc_slice;
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8