diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-14 14:47:59 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-09-15 11:40:59 -0400 |
commit | 734dbfa590baf560741f0754bd81c07dfb829485 (patch) | |
tree | 4cf32837fd3823ac53b4244e6aab794a4a6eec46 /src/or/scheduler.c | |
parent | bd34a0d30f754f3dd75199d915febe918d058f30 (diff) | |
download | tor-734dbfa590baf560741f0754bd81c07dfb829485.tar.gz tor-734dbfa590baf560741f0754bd81c07dfb829485.zip |
sched: Make the scheduler object static
Each type of scheduler implements its own static scheduler_t object and
returns a reference to it.
This commit also makes it a const pointer that is it can only change inside
the scheduler type subsystem but not outside for extra protection.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler.c')
-rw-r--r-- | src/or/scheduler.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/scheduler.c b/src/or/scheduler.c index 8d2dfac088..af4d9e5f6b 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -148,7 +148,7 @@ * outside the scheduling system) *****************************************************************************/ -STATIC scheduler_t *the_scheduler; +STATIC const scheduler_t *the_scheduler; /* * We keep a list of channels that are pending - i.e, have cells to write @@ -317,7 +317,7 @@ select_scheduler(void) static void set_scheduler(void) { - scheduler_t *old_scheduler = the_scheduler; + const scheduler_t *old_scheduler = the_scheduler; /* From the options, select the scheduler type to set. */ select_scheduler(); @@ -395,7 +395,6 @@ scheduler_free_all(void) if (the_scheduler && the_scheduler->free_all) { the_scheduler->free_all(); } - tor_free(the_scheduler); the_scheduler = NULL; } |