diff options
Diffstat (limited to 'test/core/channel/metadata_buffer_test.c')
-rw-r--r-- | test/core/channel/metadata_buffer_test.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/core/channel/metadata_buffer_test.c b/test/core/channel/metadata_buffer_test.c index 50fbcaea69..9d7e1591f8 100644 --- a/test/core/channel/metadata_buffer_test.c +++ b/test/core/channel/metadata_buffer_test.c @@ -32,6 +32,7 @@ */ #include "src/core/channel/metadata_buffer.h" +#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include "test/core/util/test_config.h" @@ -42,12 +43,12 @@ /* construct a buffer with some prefix followed by an integer converted to a string */ static gpr_slice construct_buffer(size_t prefix_length, size_t index) { - gpr_slice buffer = gpr_slice_malloc(prefix_length + 32); + gpr_slice buffer = gpr_slice_malloc(prefix_length + GPR_LTOA_MIN_BUFSIZE); memset(GPR_SLICE_START_PTR(buffer), 'a', prefix_length); GPR_SLICE_SET_LENGTH( - buffer, prefix_length + - sprintf((char *)GPR_SLICE_START_PTR(buffer) + prefix_length, - "%d", (int)index)); + buffer, + prefix_length + + gpr_ltoa(index, (char *)GPR_SLICE_START_PTR(buffer) + prefix_length)); return buffer; } |