Remove use of sprintf

pull/188/head
Craig Tiller 10 years ago
parent 37d4eb56f0
commit cf7bd708cf
  1. 2
      test/core/channel/metadata_buffer_test.c
  2. 6
      test/core/end2end/tests/census_simple_request.c

@ -43,7 +43,7 @@
/* 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,

@ -37,6 +37,7 @@
#include <string.h>
#include <unistd.h>
#include "src/core/support/string.h"
#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -145,7 +146,7 @@ static void test_body(grpc_end2end_test_fixture f) {
static void test_invoke_request_with_census(
grpc_end2end_test_config config, const char *name,
void (*body)(grpc_end2end_test_fixture f)) {
char fullname[64];
char *fullname;
grpc_end2end_test_fixture f;
grpc_arg client_arg, server_arg;
grpc_channel_args client_args, server_args;
@ -163,11 +164,12 @@ static void test_invoke_request_with_census(
server_args.num_args = 1;
server_args.args = &server_arg;
sprintf(fullname, "%s/%s", __FUNCTION__, name);
gpr_asprintf(&fullname, "%s/%s", __FUNCTION__, name);
f = begin_test(config, fullname, &client_args, &server_args);
body(f);
end_test(&f);
config.tear_down_data(&f);
gpr_free(fullname);
}
void grpc_end2end_tests(grpc_end2end_test_config config) {

Loading…
Cancel
Save