Merge branch 'kill-printf' into kill-more-printf

pull/187/head
Craig Tiller 10 years ago
commit 99e5bc2f4a
  1. 5
      src/core/support/string.h
  2. 3
      src/core/transport/chttp2/timeout_encoding.h
  3. 2
      test/core/transport/chttp2/timeout_encoding_test.c

@ -60,11 +60,12 @@ char *gpr_hexdump(const char *buf, size_t len, gpr_uint32 flags);
int gpr_parse_bytes_to_uint32(const char *data, size_t length,
gpr_uint32 *result);
/* minimum buffer size for calling ltoa */
/* Minimum buffer size for calling ltoa */
#define GPR_LTOA_MIN_BUFSIZE (3 * sizeof(long))
/* Convert a long to a string in base 10; returns the length of the
output string (or 0 on failure) */
output string (or 0 on failure).
output must be at least GPR_LTOA_MIN_BUFSIZE bytes long. */
int gpr_ltoa(long value, char *output);
/* Reverse a run of bytes */

@ -34,8 +34,11 @@
#ifndef __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_
#define __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_
#include "src/core/support/string.h"
#include <grpc/support/time.h>
#define GRPC_CHTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE (GPR_LTOA_MIN_BUFSIZE + 1)
/* Encode/decode timeouts to the GRPC over HTTP2 format;
encoding may round up arbitrarily */
void grpc_chttp2_encode_timeout(gpr_timespec timeout, char *buffer);

@ -43,7 +43,7 @@
#define LOG_TEST() gpr_log(GPR_INFO, "%s", __FUNCTION__)
static void assert_encodes_as(gpr_timespec ts, const char *s) {
char buffer[32];
char buffer[GRPC_CHTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
grpc_chttp2_encode_timeout(ts, buffer);
gpr_log(GPR_INFO, "check '%s' == '%s'", buffer, s);
GPR_ASSERT(0 == strcmp(buffer, s));

Loading…
Cancel
Save