34 #ifndef GRPC_IMPL_CODEGEN_SLICE_H
35 #define GRPC_IMPL_CODEGEN_SLICE_H
79 #define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
104 #define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
126 #define GRPC_SLICE_START_PTR(slice) \
127 ((slice).refcount ? (slice).data.refcounted.bytes \
128 : (slice).data.inlined.bytes)
129 #define GRPC_SLICE_LENGTH(slice) \
130 ((slice).refcount ? (slice).data.refcounted.length \
131 : (slice).data.inlined.length)
132 #define GRPC_SLICE_SET_LENGTH(slice, newlen) \
133 ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
134 : ((slice).data.inlined.length = (uint8_t)(newlen)))
135 #define GRPC_SLICE_END_PTR(slice) \
136 GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
137 #define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
139 #ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
142 #define GPR_SLICE_START_PTR(slice) \
143 ((slice).refcount ? (slice).data.refcounted.bytes \
144 : (slice).data.inlined.bytes)
145 #define GPR_SLICE_LENGTH(slice) \
146 ((slice).refcount ? (slice).data.refcounted.length \
147 : (slice).data.inlined.length)
148 #define GPR_SLICE_SET_LENGTH(slice, newlen) \
149 ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
150 : ((slice).data.inlined.length = (uint8_t)(newlen)))
151 #define GPR_SLICE_END_PTR(slice) \
152 GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
153 #define GPR_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
struct grpc_slice_refcount_vtable grpc_slice_refcount_vtable
struct grpc_slice_refcount * sub_refcount
Definition: slice.h:76
struct grpc_slice::@19::@21 inlined
union grpc_slice::@19 data
void(* unref)(grpc_exec_ctx *exec_ctx, void *)
Definition: slice.h:60
grpc_slice * slices
Definition: slice.h:114
struct grpc_slice::@19::@20 refcounted
void(* ref)(void *)
Definition: slice.h:59
size_t length
Definition: slice.h:121
int(* eq)(grpc_slice a, grpc_slice b)
Definition: slice.h:61
struct grpc_slice_refcount * refcount
Definition: slice.h:91
grpc_slice * base_slices
Definition: slice.h:111
uint32_t(* hash)(grpc_slice slice)
Definition: slice.h:62
size_t capacity
Definition: slice.h:119
struct grpc_exec_ctx grpc_exec_ctx
Definition: exec_ctx_fwd.h:39
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS
Definition: slice.h:104
uint8_t * bytes
Definition: slice.h:94
#define GRPC_SLICE_INLINED_SIZE
Definition: slice.h:79
size_t length
Definition: slice.h:95
struct grpc_slice_refcount grpc_slice_refcount
uint8_t length
Definition: slice.h:98
size_t count
Definition: slice.h:116
const grpc_slice_refcount_vtable * vtable
Definition: slice.h:71