34 #ifndef GRPC_IMPL_CODEGEN_SLICE_H
35 #define GRPC_IMPL_CODEGEN_SLICE_H
80 #define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
105 #define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
127 #define GRPC_SLICE_START_PTR(slice) \
128 ((slice).refcount ? (slice).data.refcounted.bytes \
129 : (slice).data.inlined.bytes)
130 #define GRPC_SLICE_LENGTH(slice) \
131 ((slice).refcount ? (slice).data.refcounted.length \
132 : (slice).data.inlined.length)
133 #define GRPC_SLICE_SET_LENGTH(slice, newlen) \
134 ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
135 : ((slice).data.inlined.length = (uint8_t)(newlen)))
136 #define GRPC_SLICE_END_PTR(slice) \
137 GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
138 #define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
140 #ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
143 #define GPR_SLICE_START_PTR(slice) \
144 ((slice).refcount ? (slice).data.refcounted.bytes \
145 : (slice).data.inlined.bytes)
146 #define GPR_SLICE_LENGTH(slice) \
147 ((slice).refcount ? (slice).data.refcounted.length \
148 : (slice).data.inlined.length)
149 #define GPR_SLICE_SET_LENGTH(slice, newlen) \
150 ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
151 : ((slice).data.inlined.length = (uint8_t)(newlen)))
152 #define GPR_SLICE_END_PTR(slice) \
153 GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
154 #define GPR_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
struct grpc_slice_refcount_vtable grpc_slice_refcount_vtable
Slice API.
Reference count container for grpc_slice.
Definition: slice.h:71
struct grpc_slice_refcount * sub_refcount
If a subset of this slice is taken, use this pointer for the refcount.
Definition: slice.h:77
struct grpc_slice::@19::@21 inlined
union grpc_slice::@19 data
void(* unref)(grpc_exec_ctx *exec_ctx, void *)
Definition: slice.h:61
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:91
grpc_slice * slices
slices in the array (Points to the first valid grpc_slice in the array)
Definition: slice.h:115
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice.h:109
struct grpc_slice::@19::@20 refcounted
void(* ref)(void *)
Definition: slice.h:60
Slice API.
Definition: slice.h:59
size_t length
the combined length of all slices in the array
Definition: slice.h:122
int(* eq)(grpc_slice a, grpc_slice b)
Definition: slice.h:62
struct grpc_slice_refcount * refcount
Definition: slice.h:92
grpc_slice * base_slices
This is for internal use only.
Definition: slice.h:112
uint32_t(* hash)(grpc_slice slice)
Definition: slice.h:63
size_t capacity
the number of slices allocated in the array.
Definition: slice.h:120
struct grpc_exec_ctx grpc_exec_ctx
Definition: exec_ctx_fwd.h:39
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS
Definition: slice.h:105
uint8_t * bytes
Definition: slice.h:95
#define GRPC_SLICE_INLINED_SIZE
Definition: slice.h:80
size_t length
Definition: slice.h:96
struct grpc_slice_refcount grpc_slice_refcount
Reference count container for grpc_slice.
uint8_t length
Definition: slice.h:99
size_t count
the number of slices in the array
Definition: slice.h:117
const grpc_slice_refcount_vtable * vtable
Definition: slice.h:72