diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-09 00:56:53 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-09 00:56:53 -0500 |
commit | 076654ce8423d2b8ab7285b22c13d4002942bd8b (patch) | |
tree | 2e4eef960efa18ca461a8f846acd8f921746441a /src/or/buffers.c | |
parent | 8e8c0674c4729a6aa39ded658e800baa654fe289 (diff) | |
download | tor-076654ce8423d2b8ab7285b22c13d4002942bd8b.tar.gz tor-076654ce8423d2b8ab7285b22c13d4002942bd8b.zip |
Replace magic constants for wide_circ_ids with inline function calls
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r-- | src/or/buffers.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index b6a21950e2..0e9bb99545 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -1049,9 +1049,8 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto) uint8_t command; uint16_t length; const int wide_circ_ids = linkproto >= MIN_LINK_PROTO_FOR_WIDE_CIRC_IDS; - const int circ_id_len = wide_circ_ids ? 4 : 2; - const unsigned header_len = wide_circ_ids ? VAR_CELL_MAX_HEADER_SIZE : - VAR_CELL_MAX_HEADER_SIZE - 2; + const int circ_id_len = get_circ_id_size(wide_circ_ids); + const unsigned header_len = get_var_cell_header_size(wide_circ_ids); check(); *out = NULL; if (buf->datalen < header_len) @@ -1132,9 +1131,8 @@ fetch_var_cell_from_evbuffer(struct evbuffer *buf, var_cell_t **out, var_cell_t *cell; int result = 0; const int wide_circ_ids = linkproto >= MIN_LINK_PROTO_FOR_WIDE_CIRC_IDS; - const int circ_id_len = wide_circ_ids ? 4 : 2; - const unsigned header_len = wide_circ_ids ? VAR_CELL_MAX_HEADER_SIZE : - VAR_CELL_MAX_HEADER_SIZE - 2; + const int circ_id_len = get_circ_id_size(wide_circ_ids); + const unsigned header_len = get_var_cell_header_size(wide_circ_ids); *out = NULL; buf_len = evbuffer_get_length(buf); |