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

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


commit dc3af04ba8c65e1217f834f04be2a055e8084ec8
Author: Andrea Shepard <andrea at torproject.org>
Date:   Tue Jan 28 17:25:37 2014 -0800

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

diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index bf86810..c161393 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -167,8 +167,8 @@ scheduler_free_all(void)
  * Comparison function to use when sorting pending channels
  */
 
-STATIC int
-scheduler_compare_channels(const void *c1_v, const void *c2_v)
+MOCK_IMPL(STATIC int,
+scheduler_compare_channels, (const void *c1_v, const void *c2_v))
 {
   channel_t *c1 = NULL, *c2 = NULL;
   /* These are a workaround for -Wbad-function-cast throwing a fit */
diff --git a/src/or/scheduler.h b/src/or/scheduler.h
index b0b66ee..8854d5a 100644
--- a/src/or/scheduler.h
+++ b/src/or/scheduler.h
@@ -37,7 +37,8 @@ void scheduler_touch_channel(channel_t *chan);
 /* Things only scheduler.c and its test suite should see */
 
 #ifdef SCHEDULER_PRIVATE_
-STATIC int scheduler_compare_channels(const void *c1_v, const void *c2_v);
+MOCK_DECL(STATIC int, scheduler_compare_channels,
+          (const void *c1_v, const void *c2_v));
 STATIC uint64_t scheduler_get_queue_heuristic(void);
 STATIC void scheduler_update_queue_heuristic(time_t now);
 #endif





More information about the tor-commits mailing list