[tor-commits] [tor/master] Make buf_datalen() mockable

nickm at torproject.org nickm at torproject.org
Fri Nov 28 03:58:33 UTC 2014


commit a2de0a1034b3d4c1433c548526a1401e51540bc1
Author: Andrea Shepard <andrea at torproject.org>
Date:   Thu Jan 23 06:42:14 2014 -0800

    Make buf_datalen() mockable
---
 src/or/buffers.c |    4 ++--
 src/or/buffers.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/or/buffers.c b/src/or/buffers.c
index 033f862..85eff36 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -559,8 +559,8 @@ buf_clear(buf_t *buf)
 }
 
 /** Return the number of bytes stored in <b>buf</b> */
-size_t
-buf_datalen(const buf_t *buf)
+MOCK_IMPL(size_t,
+buf_datalen, (const buf_t *buf))
 {
   return buf->datalen;
 }
diff --git a/src/or/buffers.h b/src/or/buffers.h
index c90e147..6b91a2d 100644
--- a/src/or/buffers.h
+++ b/src/or/buffers.h
@@ -24,7 +24,7 @@ void buf_shrink(buf_t *buf);
 size_t buf_shrink_freelists(int free_all);
 void buf_dump_freelist_sizes(int severity);
 
-size_t buf_datalen(const buf_t *buf);
+MOCK_DECL(size_t, buf_datalen, (const buf_t *buf));
 size_t buf_allocation(const buf_t *buf);
 size_t buf_slack(const buf_t *buf);
 





More information about the tor-commits mailing list