Sprinkle constants here and there

pull/5699/head
Craig Tiller 9 years ago
parent 9d77ed5e2d
commit ac9a6031f3
  1. 5
      src/core/transport/chttp2/frame_data.c
  2. 5
      src/core/transport/chttp2/frame_rst_stream.c
  3. 5
      src/core/transport/chttp2/frame_window_update.c

@ -117,8 +117,9 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
gpr_slice_buffer *outbuf) { gpr_slice_buffer *outbuf) {
gpr_slice hdr; gpr_slice hdr;
uint8_t *p; uint8_t *p;
static const size_t header_size = 9;
hdr = gpr_slice_malloc(9); hdr = gpr_slice_malloc(header_size);
p = GPR_SLICE_START_PTR(hdr); p = GPR_SLICE_START_PTR(hdr);
GPR_ASSERT(write_bytes < (1 << 24)); GPR_ASSERT(write_bytes < (1 << 24));
*p++ = (uint8_t)(write_bytes >> 16); *p++ = (uint8_t)(write_bytes >> 16);
@ -134,7 +135,7 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
gpr_slice_buffer_move_first(inbuf, write_bytes, outbuf); gpr_slice_buffer_move_first(inbuf, write_bytes, outbuf);
stats->framing_bytes += 9; stats->framing_bytes += header_size;
stats->data_bytes += write_bytes; stats->data_bytes += write_bytes;
} }

@ -40,8 +40,9 @@
gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code, gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
grpc_transport_one_way_stats *stats) { grpc_transport_one_way_stats *stats) {
gpr_slice slice = gpr_slice_malloc(13); static const size_t frame_size = 13;
stats->framing_bytes += 13; gpr_slice slice = gpr_slice_malloc(frame_size);
stats->framing_bytes += frame_size;
uint8_t *p = GPR_SLICE_START_PTR(slice); uint8_t *p = GPR_SLICE_START_PTR(slice);
*p++ = 0; *p++ = 0;

@ -38,8 +38,9 @@
gpr_slice grpc_chttp2_window_update_create( gpr_slice grpc_chttp2_window_update_create(
uint32_t id, uint32_t window_update, grpc_transport_one_way_stats *stats) { uint32_t id, uint32_t window_update, grpc_transport_one_way_stats *stats) {
gpr_slice slice = gpr_slice_malloc(13); static const size_t frame_size = 13;
stats->header_bytes += 13; gpr_slice slice = gpr_slice_malloc(frame_size);
stats->header_bytes += frame_size;
uint8_t *p = GPR_SLICE_START_PTR(slice); uint8_t *p = GPR_SLICE_START_PTR(slice);
GPR_ASSERT(window_update); GPR_ASSERT(window_update);

Loading…
Cancel
Save