aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/transport
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-01-23 15:22:42 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-01-23 15:22:42 -0800
commit03f75259c5a5ead4c336d3c353f15b72af0cdafb (patch)
tree929adb92859055b48444ce12ae7bcfbc62770779 /test/core/transport
parent28214ea1b24a374335a2a36691cb5d14e1234938 (diff)
Remove uses of sprintf
Diffstat (limited to 'test/core/transport')
-rw-r--r--test/core/transport/chttp2/timeout_encoding_test.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c
index ffa0070e34..0ad90dbcef 100644
--- a/test/core/transport/chttp2/timeout_encoding_test.c
+++ b/test/core/transport/chttp2/timeout_encoding_test.c
@@ -36,6 +36,8 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/support/string.h"
+#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
#include "test/core/util/test_config.h"
@@ -93,16 +95,23 @@ void decode_suite(char ext, gpr_timespec (*answer)(long x)) {
1234567, 12345678, 123456789, 98765432, 9876543, 987654,
98765, 9876, 987, 98, 9};
int i;
- char input[32];
+ char *input;
for (i = 0; i < GPR_ARRAY_SIZE(test_vals); i++) {
- sprintf(input, "%ld%c", test_vals[i], ext);
+ gpr_asprintf(&input, "%ld%c", test_vals[i], ext);
assert_decodes_as(input, answer(test_vals[i]));
- sprintf(input, " %ld%c", test_vals[i], ext);
+ gpr_free(input);
+
+ gpr_asprintf(&input, " %ld%c", test_vals[i], ext);
assert_decodes_as(input, answer(test_vals[i]));
- sprintf(input, "%ld %c", test_vals[i], ext);
+ gpr_free(input);
+
+ gpr_asprintf(&input, "%ld %c", test_vals[i], ext);
assert_decodes_as(input, answer(test_vals[i]));
- sprintf(input, "%ld %c ", test_vals[i], ext);
+ gpr_free(input);
+
+ gpr_asprintf(&input, "%ld %c ", test_vals[i], ext);
assert_decodes_as(input, answer(test_vals[i]));
+ gpr_free(input);
}
}