expose gpr_slice_to_cstring()

pull/4341/head
Sree Kuchibhotla 9 years ago
parent b6fd9bcbb6
commit 38d39f4622
  1. 4
      include/grpc/support/slice.h
  2. 1
      test/core/support/slice_test.c

@ -175,6 +175,10 @@ gpr_slice gpr_empty_slice(void);
int gpr_slice_cmp(gpr_slice a, gpr_slice b);
int gpr_slice_str_cmp(gpr_slice a, const char *b);
/* Returns a c-string representation of a slice. Useful for logging or debugging
purposes only. The string representation can change in future */
char *gpr_slice_to_cstring(gpr_slice slice);
#ifdef __cplusplus
}
#endif

@ -221,6 +221,7 @@ static void test_slice_from_copied_string_works(void) {
LOG_TEST_NAME("test_slice_from_copied_string_works");
slice = gpr_slice_from_copied_string(text);
gpr_log(GPR_INFO, "slice: %s", gpr_slice_to_cstring(slice));
GPR_ASSERT(strlen(text) == GPR_SLICE_LENGTH(slice));
GPR_ASSERT(0 ==
memcmp(text, GPR_SLICE_START_PTR(slice), GPR_SLICE_LENGTH(slice)));

Loading…
Cancel
Save