From e6f95a7c47ac884dc74f843c4fc8fa29881b7407 Mon Sep 17 00:00:00 2001 From: Julie Schwartz Date: Tue, 28 May 2024 10:02:48 +1200 Subject: [PATCH] Bluesim: Fix function call arguments in debug function The EventQueue::print() function was calling bk_clock_name() with the wrong number of arguments, but fortunately print() is not used anywhere, as it only exists for use when debugging. The issue is resolved by adding an additional parameter to print(). However, since so many functions in the EventQueue class take the tSimStateHdl as an argument, it might make sense for the EventQueue constructor to take that value and store it. --- src/bluesim/event_queue.cxx | 6 +++--- src/bluesim/event_queue.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bluesim/event_queue.cxx b/src/bluesim/event_queue.cxx index 09c64f2d3..28bbc3eb8 100644 --- a/src/bluesim/event_queue.cxx +++ b/src/bluesim/event_queue.cxx @@ -5,7 +5,7 @@ /* we need these for the debugging routines only */ #include "priority.h" -extern "C" const char* bk_clock_name(tClock handle); +extern "C" const char* bk_clock_name(tSimStateHdl simHdl, tClock handle); /* Fundamental heap operations */ @@ -222,7 +222,7 @@ void EventQueue::clear() } /* Print the event queue contents (for debugging) */ -void EventQueue::print() const +void EventQueue::print(tSimStateHdl simHdl) const { printf("Event queue:\n"); for (unsigned int i = 0; i < count; ++i) @@ -231,6 +231,6 @@ void EventQueue::print() const events[i].fn, events[i].data.ptr, events[i].at, priority_group_name(priority_group(events[i].priority)), priority_slot_name(priority_slot(events[i].priority)), - bk_clock_name(priority_clock(events[i].priority))); + bk_clock_name(simHdl, priority_clock(events[i].priority))); } } diff --git a/src/bluesim/event_queue.h b/src/bluesim/event_queue.h index 8572a95e3..1bad27f20 100644 --- a/src/bluesim/event_queue.h +++ b/src/bluesim/event_queue.h @@ -81,7 +81,7 @@ class EventQueue void clear(); // debugging utility function - void print() const; + void print(tSimStateHdl simHdl) const; private: // heap maintenance functions bool isValid();