slice/slice.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
22 
23 #include <string.h>
24 
25 #include <new>
26 
27 #include <grpc/slice.h>
28 #include <grpc/support/alloc.h>
29 #include <grpc/support/log.h>
30 
34 
36  char* out = static_cast<char*>(gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1));
39  return out;
40 }
41 
44 }
45 
50  return out;
51 }
52 
53 namespace grpc_core {
54 
55 /* grpc_slice_new support structures - we create a refcount object extended
56  with the user provided data pointer & destroy function */
58  public:
59  NewSliceRefcount(void (*destroy)(void*), void* user_data)
62  user_data_(user_data) {}
64 
65  private:
67  delete static_cast<NewSliceRefcount*>(arg);
68  }
69 
70  void (*user_destroy_)(void*);
71  void* user_data_;
72 };
73 
74 } // namespace grpc_core
75 
77  if (s.refcount == nullptr ||
78  s.refcount == grpc_slice_refcount::NoopRefcount()) {
79  return 0;
80  } else {
81  return s.data.refcounted.length;
82  }
83 }
84 
87 }
88 
91 }
92 
94  void (*destroy)(void*),
95  void* user_data) {
98  slice.data.refcounted.bytes = static_cast<uint8_t*>(p);
100  return slice;
101 }
102 
103 grpc_slice grpc_slice_new(void* p, size_t len, void (*destroy)(void*)) {
104  /* Pass "p" to *destroy when the slice is no longer needed. */
106 }
107 
108 namespace grpc_core {
109 /* grpc_slice_new_with_len support structures - we create a refcount object
110  extended with the user provided data pointer & destroy function */
112  public:
113  NewWithLenSliceRefcount(void (*destroy)(void*, size_t), void* user_data,
114  size_t user_length)
116  user_data_(user_data),
117  user_length_(user_length),
120 
121  private:
123  delete static_cast<NewWithLenSliceRefcount*>(arg);
124  }
125 
126  void* user_data_;
127  size_t user_length_;
128  void (*user_destroy_)(void*, size_t);
129 };
130 
133  public:
136 
137  private:
139  delete static_cast<MovedStringSliceRefCount*>(arg);
140  }
141 
143 };
144 
145 // grpc_slice_from_cpp_string() ref count.
147  public:
150 
151  private:
153  delete static_cast<MovedCppStringSliceRefCount*>(arg);
154  }
155 
157 };
158 
159 } // namespace grpc_core
160 
162  void (*destroy)(void*, size_t)) {
165  slice.data.refcounted.bytes = static_cast<uint8_t*>(p);
167  return slice;
168 }
169 
170 grpc_slice grpc_slice_from_copied_buffer(const char* source, size_t len) {
171  if (len == 0) return grpc_empty_slice();
173  memcpy(GRPC_SLICE_START_PTR(out), source, len);
174  return out;
175 }
176 
178  return grpc_slice_from_copied_buffer(source, strlen(source));
179 }
180 
182  size_t len) {
183  uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get());
185  if (len <= sizeof(slice.data.inlined.bytes)) {
186  slice.refcount = nullptr;
189  } else {
193  }
194  return slice;
195 }
196 
198  const size_t len = strlen(p.get());
200 }
201 
204  if (str.size() <= sizeof(slice.data.inlined.bytes)) {
205  slice.refcount = nullptr;
206  slice.data.inlined.length = str.size();
207  memcpy(GRPC_SLICE_START_PTR(slice), str.data(), str.size());
208  } else {
210  reinterpret_cast<uint8_t*>(const_cast<char*>(str.data()));
211  slice.data.refcounted.length = str.size();
213  }
214  return slice;
215 }
216 
219  uint8_t* memory = new uint8_t[sizeof(grpc_slice_refcount) + length];
220  slice.refcount = new (memory) grpc_slice_refcount(
221  [](grpc_slice_refcount* p) { delete[] reinterpret_cast<uint8_t*>(p); });
222  slice.data.refcounted.bytes = memory + sizeof(grpc_slice_refcount);
224  return slice;
225 }
226 
230  slice.refcount = nullptr;
232  return slice;
233  } else {
235  }
236 }
237 
238 static grpc_slice sub_no_ref(const grpc_slice& source, size_t begin,
239  size_t end) {
240  grpc_slice subset;
241 
242  GPR_ASSERT(end >= begin);
243 
244  if (source.refcount != nullptr) {
245  /* Enforce preconditions */
246  GPR_ASSERT(source.data.refcounted.length >= end);
247 
248  /* Build the result */
249  subset.refcount = source.refcount;
250  /* Point into the source array */
251  subset.data.refcounted.bytes = source.data.refcounted.bytes + begin;
252  subset.data.refcounted.length = end - begin;
253  } else {
254  /* Enforce preconditions */
255  GPR_ASSERT(source.data.inlined.length >= end);
256  subset.refcount = nullptr;
257  subset.data.inlined.length = static_cast<uint8_t>(end - begin);
258  memcpy(subset.data.inlined.bytes, source.data.inlined.bytes + begin,
259  end - begin);
260  }
261  return subset;
262 }
263 
265  return sub_no_ref(source, begin, end);
266 }
267 
268 grpc_slice grpc_slice_sub(grpc_slice source, size_t begin, size_t end) {
269  grpc_slice subset;
270 
271  if (end - begin <= sizeof(subset.data.inlined.bytes)) {
272  subset.refcount = nullptr;
273  subset.data.inlined.length = static_cast<uint8_t>(end - begin);
275  end - begin);
276  } else {
277  subset = grpc_slice_sub_no_ref(source, begin, end);
278  /* Bump the refcount */
280  subset.refcount->Ref();
281  }
282  }
283  return subset;
284 }
285 
287  grpc_slice_ref_whom ref_whom) {
288  grpc_slice tail;
289 
290  if (source->refcount == nullptr) {
291  /* inlined data, copy it out */
292  GPR_ASSERT(source->data.inlined.length >= split);
293  tail.refcount = nullptr;
294  tail.data.inlined.length =
295  static_cast<uint8_t>(source->data.inlined.length - split);
296  memcpy(tail.data.inlined.bytes, source->data.inlined.bytes + split,
297  tail.data.inlined.length);
298  source->data.inlined.length = static_cast<uint8_t>(split);
299  } else if (source->refcount == grpc_slice_refcount::NoopRefcount()) {
300  /* refcount == NoopRefcount(), so we can just split in-place */
302  tail.data.refcounted.bytes = source->data.refcounted.bytes + split;
303  tail.data.refcounted.length = source->data.refcounted.length - split;
304  source->data.refcounted.length = split;
305  } else {
306  size_t tail_length = source->data.refcounted.length - split;
307  GPR_ASSERT(source->data.refcounted.length >= split);
308  if (tail_length < sizeof(tail.data.inlined.bytes) &&
309  ref_whom != GRPC_SLICE_REF_TAIL) {
310  /* Copy out the bytes - it'll be cheaper than refcounting */
311  tail.refcount = nullptr;
312  tail.data.inlined.length = static_cast<uint8_t>(tail_length);
313  memcpy(tail.data.inlined.bytes, source->data.refcounted.bytes + split,
314  tail_length);
315  } else {
316  /* Build the result */
317  switch (ref_whom) {
318  case GRPC_SLICE_REF_TAIL:
319  tail.refcount = source->refcount;
321  break;
322  case GRPC_SLICE_REF_HEAD:
324  break;
325  case GRPC_SLICE_REF_BOTH:
326  tail.refcount = source->refcount;
327  /* Bump the refcount */
329  tail.refcount->Ref();
330  }
331  break;
332  }
333  /* Point into the source array */
334  tail.data.refcounted.bytes = source->data.refcounted.bytes + split;
335  tail.data.refcounted.length = tail_length;
336  }
337  source->data.refcounted.length = split;
338  }
339 
340  return tail;
341 }
342 
345 }
346 
348  grpc_slice head;
349 
350  if (source->refcount == nullptr) {
351  GPR_ASSERT(source->data.inlined.length >= split);
352 
353  head.refcount = nullptr;
354  head.data.inlined.length = static_cast<uint8_t>(split);
355  memcpy(head.data.inlined.bytes, source->data.inlined.bytes, split);
356  source->data.inlined.length =
357  static_cast<uint8_t>(source->data.inlined.length - split);
358  memmove(source->data.inlined.bytes, source->data.inlined.bytes + split,
359  source->data.inlined.length);
360  } else if (split < sizeof(head.data.inlined.bytes)) {
361  GPR_ASSERT(source->data.refcounted.length >= split);
362 
363  head.refcount = nullptr;
364  head.data.inlined.length = static_cast<uint8_t>(split);
365  memcpy(head.data.inlined.bytes, source->data.refcounted.bytes, split);
366  source->data.refcounted.bytes += split;
367  source->data.refcounted.length -= split;
368  } else {
369  GPR_ASSERT(source->data.refcounted.length >= split);
370 
371  /* Build the result */
372  head.refcount = source->refcount;
373  /* Bump the refcount */
375  head.refcount->Ref();
376  }
377  /* Point into the source array */
378  head.data.refcounted.bytes = source->data.refcounted.bytes;
379  head.data.refcounted.length = split;
380  source->data.refcounted.bytes += split;
381  source->data.refcounted.length -= split;
382  }
383 
384  return head;
385 }
386 
388  if (GRPC_SLICE_LENGTH(a) != GRPC_SLICE_LENGTH(b)) return false;
389  if (GRPC_SLICE_LENGTH(a) == 0) return true;
390  return 0 == memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b),
392 }
393 
395  const grpc_slice& b_not_inline) {
396  size_t a_len;
397  const uint8_t* a_ptr;
398  if (a.refcount) {
399  a_len = a.data.refcounted.length;
400  a_ptr = a.data.refcounted.bytes;
401  } else {
402  a_len = a.data.inlined.length;
403  a_ptr = &a.data.inlined.bytes[0];
404  }
405  if (a_len != b_not_inline.data.refcounted.length) {
406  return true;
407  }
408  if (a_len == 0) {
409  return false;
410  }
411  // This check *must* occur after the a_len == 0 check
412  // to retain compatibility with grpc_slice_eq.
413  if (a_ptr == nullptr) {
414  return true;
415  }
416  return memcmp(a_ptr, b_not_inline.data.refcounted.bytes, a_len);
417 }
418 
420  int d = static_cast<int>(GRPC_SLICE_LENGTH(a) - GRPC_SLICE_LENGTH(b));
421  if (d != 0) return d;
422  return memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b),
424 }
425 
426 int grpc_slice_str_cmp(grpc_slice a, const char* b) {
427  size_t b_length = strlen(b);
428  int d = static_cast<int>(GRPC_SLICE_LENGTH(a) - b_length);
429  if (d != 0) return d;
430  return memcmp(GRPC_SLICE_START_PTR(a), b, b_length);
431 }
432 
434  if (a.refcount == nullptr || b.refcount == nullptr) {
435  return grpc_slice_eq(a, b);
436  }
437  return a.data.refcounted.length == b.data.refcounted.length &&
438  a.data.refcounted.bytes == b.data.refcounted.bytes;
439 }
440 
441 int grpc_slice_buf_start_eq(grpc_slice a, const void* b, size_t len) {
442  if (GRPC_SLICE_LENGTH(a) < len) return 0;
443  return 0 == memcmp(GRPC_SLICE_START_PTR(a), b, len);
444 }
445 
447  const char* b = reinterpret_cast<const char*> GRPC_SLICE_START_PTR(s);
448  int i;
449  for (i = static_cast<int> GRPC_SLICE_LENGTH(s) - 1; i != -1 && b[i] != c;
450  i--) {
451  }
452  return i;
453 }
454 
456  const char* b = reinterpret_cast<const char*> GRPC_SLICE_START_PTR(s);
457  const char* p = static_cast<const char*>(memchr(b, c, GRPC_SLICE_LENGTH(s)));
458  return p == nullptr ? -1 : static_cast<int>(p - b);
459 }
460 
461 int grpc_slice_slice(grpc_slice haystack, grpc_slice needle) {
462  size_t haystack_len = GRPC_SLICE_LENGTH(haystack);
463  const uint8_t* haystack_bytes = GRPC_SLICE_START_PTR(haystack);
464  size_t needle_len = GRPC_SLICE_LENGTH(needle);
465  const uint8_t* needle_bytes = GRPC_SLICE_START_PTR(needle);
466 
467  if (haystack_len == 0 || needle_len == 0) return -1;
468  if (haystack_len < needle_len) return -1;
469  if (haystack_len == needle_len) {
470  return grpc_slice_eq(haystack, needle) ? 0 : -1;
471  }
472  if (needle_len == 1) {
473  return grpc_slice_chr(haystack, static_cast<char>(*needle_bytes));
474  }
475 
476  const uint8_t* last = haystack_bytes + haystack_len - needle_len;
477  for (const uint8_t* cur = haystack_bytes; cur != last; ++cur) {
478  if (0 == memcmp(cur, needle_bytes, needle_len)) {
479  return static_cast<int>(cur - haystack_bytes);
480  }
481  }
482  return -1;
483 }
484 
489  return copy;
490 }
GRPC_SLICE_REF_HEAD
@ GRPC_SLICE_REF_HEAD
Definition: include/grpc/slice.h:109
xds_interop_client.str
str
Definition: xds_interop_client.py:487
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
slice.h
grpc_core::slice_detail::BaseSlice::TakeCSlice
grpc_slice TakeCSlice()
Definition: src/core/lib/slice/slice.h:82
grpc_slice_copy
grpc_slice grpc_slice_copy(grpc_slice s)
Definition: slice/slice.cc:46
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
grpc_slice_buf_start_eq
int grpc_slice_buf_start_eq(grpc_slice a, const void *b, size_t len)
Definition: slice/slice.cc:441
grpc_slice_from_static_string
grpc_slice grpc_slice_from_static_string(const char *s)
Definition: slice/slice.cc:89
log.h
grpc_slice_is_equivalent
int grpc_slice_is_equivalent(grpc_slice a, grpc_slice b)
Definition: slice/slice.cc:433
grpc_slice::refcount
struct grpc_slice_refcount * refcount
Definition: include/grpc/impl/codegen/slice.h:66
grpc_core::MovedCppStringSliceRefCount::Destroy
static void Destroy(grpc_slice_refcount *arg)
Definition: slice/slice.cc:152
grpc_slice_from_moved_string
grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr< char > p)
Definition: slice/slice.cc:197
begin
char * begin
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1007
grpc_core::NewWithLenSliceRefcount::user_destroy_
void(* user_destroy_)(void *, size_t)
Definition: slice/slice.cc:128
slice.h
grpc_core::NewWithLenSliceRefcount::user_data_
void * user_data_
Definition: slice/slice.cc:126
grpc_core::MovedStringSliceRefCount::Destroy
static void Destroy(grpc_slice_refcount *arg)
Definition: slice/slice.cc:138
grpc_slice::grpc_slice_data::grpc_slice_refcounted::length
size_t length
Definition: include/grpc/impl/codegen/slice.h:69
grpc_core::NewWithLenSliceRefcount::Destroy
static void Destroy(grpc_slice_refcount *arg)
Definition: slice/slice.cc:122
grpc_slice_new
grpc_slice grpc_slice_new(void *p, size_t len, void(*destroy)(void *))
Definition: slice/slice.cc:103
grpc_core
Definition: call_metric_recorder.h:31
string.h
copy
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
Definition: message_compress.cc:145
grpc_core::slice_detail::StaticConstructors< StaticSlice >::FromStaticString
static StaticSlice FromStaticString(const char *s)
Definition: src/core/lib/slice/slice.h:201
grpc_slice_rchr
int grpc_slice_rchr(grpc_slice s, char c)
Definition: slice/slice.cc:446
grpc_slice_eq
int grpc_slice_eq(grpc_slice a, grpc_slice b)
Definition: slice/slice.cc:387
GRPC_SLICE_MALLOC
#define GRPC_SLICE_MALLOC(len)
Definition: include/grpc/slice.h:70
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_slice_differs_refcounted
int grpc_slice_differs_refcounted(const grpc_slice &a, const grpc_slice &b_not_inline)
Definition: slice/slice.cc:394
gpr_malloc
GPRAPI void * gpr_malloc(size_t size)
Definition: alloc.cc:29
grpc_empty_slice
grpc_slice grpc_empty_slice(void)
Definition: slice/slice.cc:42
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
xds_manager.p
p
Definition: xds_manager.py:60
grpc_slice_slice
int grpc_slice_slice(grpc_slice haystack, grpc_slice needle)
Definition: slice/slice.cc:461
grpc_core::NewWithLenSliceRefcount::NewWithLenSliceRefcount
NewWithLenSliceRefcount(void(*destroy)(void *, size_t), void *user_data, size_t user_length)
Definition: slice/slice.cc:113
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
grpc_slice_refcount::Ref
void Ref()
Definition: slice_refcount_base.h:43
slice_refcount_base.h
grpc_core::MovedCppStringSliceRefCount
Definition: slice/slice.cc:146
memory.h
grpc_slice_refcount::NoopRefcount
static grpc_slice_refcount * NoopRefcount()
Definition: slice_refcount_base.h:29
grpc_core::NewSliceRefcount::NewSliceRefcount
NewSliceRefcount(void(*destroy)(void *), void *user_data)
Definition: slice/slice.cc:59
GRPC_SLICE_REF_BOTH
@ GRPC_SLICE_REF_BOTH
Definition: include/grpc/slice.h:110
grpc_slice_new_with_user_data
grpc_slice grpc_slice_new_with_user_data(void *p, size_t len, void(*destroy)(void *), void *user_data)
Definition: slice/slice.cc:93
grpc_slice_from_copied_buffer
grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
Definition: slice/slice.cc:170
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
grpc_slice_sub
grpc_slice grpc_slice_sub(grpc_slice source, size_t begin, size_t end)
Definition: slice/slice.cc:268
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
grpc_slice_str_cmp
int grpc_slice_str_cmp(grpc_slice a, const char *b)
Definition: slice/slice.cc:426
grpc_slice_cmp
int grpc_slice_cmp(grpc_slice a, grpc_slice b)
Definition: slice/slice.cc:419
grpc_slice::grpc_slice_data::grpc_slice_inlined::length
uint8_t length
Definition: include/grpc/impl/codegen/slice.h:73
grpc_slice_to_c_string
char * grpc_slice_to_c_string(grpc_slice slice)
Definition: slice/slice.cc:35
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
grpc_core::slice_detail::EmptySlice
static constexpr grpc_slice EmptySlice()
Definition: src/core/lib/slice/slice.h:59
grpc_slice_refcount
Definition: slice_refcount_base.h:25
grpc_core::NewSliceRefcount::user_destroy_
void(* user_destroy_)(void *)
Definition: slice/slice.cc:70
grpc_core::NewSliceRefcount
Definition: slice/slice.cc:57
grpc_slice::grpc_slice_data::inlined
struct grpc_slice::grpc_slice_data::grpc_slice_inlined inlined
grpc_slice_memory_usage
size_t grpc_slice_memory_usage(grpc_slice s)
Definition: slice/slice.cc:76
grpc_slice_split_tail
grpc_slice grpc_slice_split_tail(grpc_slice *source, size_t split)
Definition: slice/slice.cc:343
grpc_slice_malloc_large
grpc_slice grpc_slice_malloc_large(size_t length)
Definition: slice/slice.cc:217
GRPC_SLICE_START_PTR
#define GRPC_SLICE_START_PTR(slice)
Definition: include/grpc/impl/codegen/slice.h:101
grpc_core::MovedStringSliceRefCount
Definition: slice/slice.cc:132
arg
Definition: cmdline.cc:40
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
grpc_slice_ref_whom
grpc_slice_ref_whom
Definition: include/grpc/slice.h:107
slice_internal.h
grpc_slice_malloc
grpc_slice grpc_slice_malloc(size_t length)
Definition: slice/slice.cc:227
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
grpc_slice_from_static_buffer
grpc_slice grpc_slice_from_static_buffer(const void *s, size_t len)
Definition: slice/slice.cc:85
d
static const fe d
Definition: curve25519_tables.h:19
grpc_slice_sub_no_ref
grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end)
Definition: slice/slice.cc:264
grpc_core::UniquePtr
std::unique_ptr< T, DefaultDeleteChar > UniquePtr
Definition: src/core/lib/gprpp/memory.h:43
grpc_slice_split_tail_maybe_ref
grpc_slice grpc_slice_split_tail_maybe_ref(grpc_slice *source, size_t split, grpc_slice_ref_whom ref_whom)
Definition: slice/slice.cc:286
GRPC_SLICE_REF_TAIL
@ GRPC_SLICE_REF_TAIL
Definition: include/grpc/slice.h:108
GRPC_SLICE_LENGTH
#define GRPC_SLICE_LENGTH(slice)
Definition: include/grpc/impl/codegen/slice.h:104
grpc_slice_new_with_len
grpc_slice grpc_slice_new_with_len(void *p, size_t len, void(*destroy)(void *, size_t))
Definition: slice/slice.cc:161
grpc_slice::grpc_slice_data::refcounted
struct grpc_slice::grpc_slice_data::grpc_slice_refcounted refcounted
memory_diff.cur
def cur
Definition: memory_diff.py:83
grpc_core::slice_detail::StaticConstructors< StaticSlice >::FromStaticBuffer
static StaticSlice FromStaticBuffer(const void *s, size_t len)
Definition: src/core/lib/slice/slice.h:209
grpc_core::MovedCppStringSliceRefCount::str_
std::string str_
Definition: slice/slice.cc:156
alloc.h
grpc_core::MovedStringSliceRefCount::str_
UniquePtr< char > str_
Definition: slice/slice.cc:142
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc_slice::data
union grpc_slice::grpc_slice_data data
arg
struct arg arg
grpc_core::NewWithLenSliceRefcount
Definition: slice/slice.cc:111
GRPC_SLICE_INLINED_SIZE
#define GRPC_SLICE_INLINED_SIZE
Definition: include/grpc/impl/codegen/slice.h:49
grpc_slice_from_cpp_string
grpc_slice grpc_slice_from_cpp_string(std::string str)
Definition: slice/slice.cc:202
grpc_slice_chr
int grpc_slice_chr(grpc_slice s, char c)
Definition: slice/slice.cc:455
grpc_slice::grpc_slice_data::grpc_slice_inlined::bytes
uint8_t bytes[GRPC_SLICE_INLINED_SIZE]
Definition: include/grpc/impl/codegen/slice.h:74
grpc_slice::grpc_slice_data::grpc_slice_refcounted::bytes
uint8_t * bytes
Definition: include/grpc/impl/codegen/slice.h:70
grpc_core::NewSliceRefcount::Destroy
static void Destroy(grpc_slice_refcount *arg)
Definition: slice/slice.cc:66
grpc_core::NewSliceRefcount::~NewSliceRefcount
~NewSliceRefcount()
Definition: slice/slice.cc:63
grpc_core::MovedCppStringSliceRefCount::MovedCppStringSliceRefCount
MovedCppStringSliceRefCount(std::string &&str)
Definition: slice/slice.cc:148
grpc_core::NewWithLenSliceRefcount::~NewWithLenSliceRefcount
~NewWithLenSliceRefcount()
Definition: slice/slice.cc:119
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
grpc_slice_dup
grpc_slice grpc_slice_dup(grpc_slice a)
Definition: slice/slice.cc:485
grpc_core::NewSliceRefcount::user_data_
void * user_data_
Definition: slice/slice.cc:71
length
std::size_t length
Definition: abseil-cpp/absl/time/internal/test_util.cc:57
split
static void split(const char *s, char ***ss, size_t *ns)
Definition: debug/trace.cc:111
sub_no_ref
static grpc_slice sub_no_ref(const grpc_slice &source, size_t begin, size_t end)
Definition: slice/slice.cc:238
grpc_slice_from_moved_buffer
grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr< char > p, size_t len)
Definition: slice/slice.cc:181
grpc_slice_split_head
grpc_slice grpc_slice_split_head(grpc_slice *source, size_t split)
Definition: slice/slice.cc:347
grpc_core::NewWithLenSliceRefcount::user_length_
size_t user_length_
Definition: slice/slice.cc:127
destroy
static std::function< void(void *, Slot *)> destroy
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:42
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
port_platform.h
grpc_slice_from_copied_string
grpc_slice grpc_slice_from_copied_string(const char *source)
Definition: slice/slice.cc:177
grpc_core::MovedStringSliceRefCount::MovedStringSliceRefCount
MovedStringSliceRefCount(UniquePtr< char > &&str)
Definition: slice/slice.cc:134


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:13