From cddac959e7fb5729956a5250351e0fa1289d719f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 8 Aug 2017 11:54:44 -0400 Subject: Replace buf->datalen usage in proto_*.c with buf_datalen() call. This lets us remove BUFFERS_PRIVATE from two of the modules. --- src/or/proto_cell.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/or/proto_cell.c') diff --git a/src/or/proto_cell.c b/src/or/proto_cell.c index 9e5cdff423..4c86b7e4d0 100644 --- a/src/or/proto_cell.c +++ b/src/or/proto_cell.c @@ -4,7 +4,6 @@ * Copyright (c) 2007-2017, The Tor Project, Inc. */ /* See LICENSE for licensing information */ -#define BUFFERS_PRIVATE // XXXX remove. #include "or.h" #include "buffers.h" #include "proto_cell.h" @@ -56,7 +55,7 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto) 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; - if (buf->datalen < header_len) + if (buf_datalen(buf) < header_len) return 0; peek_from_buf(hdr, header_len, buf); @@ -65,7 +64,7 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto) return 0; length = ntohs(get_uint16(hdr + circ_id_len + 1)); - if (buf->datalen < (size_t)(header_len+length)) + if (buf_datalen(buf) < (size_t)(header_len+length)) return 1; result = var_cell_new(length); result->command = command; -- cgit v1.2.3-54-g00ecf