Go to the documentation of this file.
19 #ifndef GRPC_IMPL_SLICE_TYPE_H
20 #define GRPC_IMPL_SLICE_TYPE_H
44 #define GRPC_SLICE_INLINE_EXTRA_SIZE sizeof(void*)
46 #define GRPC_SLICE_INLINED_SIZE \
47 (sizeof(size_t) + sizeof(uint8_t*) - 1 + GRPC_SLICE_INLINE_EXTRA_SIZE)
49 struct grpc_slice_refcount;
76 #define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 6
98 #define GRPC_SLICE_START_PTR(slice) \
99 ((slice).refcount ? (slice).data.refcounted.bytes \
100 : (slice).data.inlined.bytes)
101 #define GRPC_SLICE_LENGTH(slice) \
102 ((slice).refcount ? (slice).data.refcounted.length \
103 : (slice).data.inlined.length)
104 #define GRPC_SLICE_SET_LENGTH(slice, newlen) \
105 ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
106 : ((slice).data.inlined.length = (uint8_t)(newlen)))
107 #define GRPC_SLICE_END_PTR(slice) \
108 GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
109 #define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
uint8_t bytes[(sizeof(size_t)+sizeof(uint8_t *) - 1+sizeof(void *))]
Definition: slice_type.h:71
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS
Definition: slice_type.h:76
struct grpc_slice_refcount * refcount
Definition: slice_type.h:63
size_t length
Definition: slice_type.h:66
Definition: slice_type.h:65
grpc_slice * slices
slices in the array (Points to the first valid grpc_slice in the array)
Definition: slice_type.h:86
Definition: slice_type.h:69
Definition: slice_type.h:64
uint8_t length
Definition: slice_type.h:70
size_t count
the number of slices in the array
Definition: slice_type.h:88
struct grpc_slice::grpc_slice_data::grpc_slice_inlined inlined
size_t length
the combined length of all slices in the array
Definition: slice_type.h:93
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1].
Definition: slice_type.h:62
struct grpc_slice::grpc_slice_data::grpc_slice_refcounted refcounted
union grpc_slice::grpc_slice_data data
grpc_slice * base_slices
This is for internal use only.
Definition: slice_type.h:83
uint8_t * bytes
Definition: slice_type.h:67
size_t capacity
the number of slices allocated in the array.
Definition: slice_type.h:91
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice_type.h:80
grpc_slice inlined[6]
inlined elements to avoid allocations
Definition: slice_type.h:95
#define GRPC_SLICE_INLINED_SIZE
Definition: slice_type.h:46
struct grpc_slice_buffer grpc_slice_buffer
Represents an expandable array of slices, to be interpreted as a single item.