Replace uses of the old Queue/PQueue generation code with new template versions

This commit is contained in:
Tim Wojtulewicz 2019-07-02 18:56:35 -07:00 committed by Jon Siwek
parent 776da8cb9e
commit efa7dbf76b
5 changed files with 8 additions and 15 deletions

View file

@ -29,8 +29,7 @@ struct ParseLocationRec {
#include "DbgBreakpoint.h" #include "DbgBreakpoint.h"
class StmtLocMapping; class StmtLocMapping;
declare(PQueue,StmtLocMapping); typedef PQueue<StmtLocMapping> Filemap; // mapping for a single file
typedef PQueue(StmtLocMapping) Filemap; // mapping for a single file
class DbgBreakpoint; class DbgBreakpoint;
class DbgWatch; class DbgWatch;

View file

@ -114,7 +114,7 @@ void choose_global_symbols_regex(const string& regex, vector<ID*>& choices,
// DebugCmdInfo implementation // DebugCmdInfo implementation
// //
PQueue(DebugCmdInfo) g_DebugCmdInfos; PQueue<DebugCmdInfo> g_DebugCmdInfos;
DebugCmdInfo::DebugCmdInfo(const DebugCmdInfo& info) DebugCmdInfo::DebugCmdInfo(const DebugCmdInfo& info)
: cmd(info.cmd), helpstring(0) : cmd(info.cmd), helpstring(0)

View file

@ -12,9 +12,6 @@ using namespace std;
#include "Queue.h" #include "Queue.h"
#include "DebugCmdConstants.h" #include "DebugCmdConstants.h"
class DebugCmdInfo;
declare(PQueue,DebugCmdInfo);
class DebugCmdInfo { class DebugCmdInfo {
public: public:
DebugCmdInfo(const DebugCmdInfo& info); DebugCmdInfo(const DebugCmdInfo& info);
@ -47,7 +44,7 @@ protected:
bool repeatable; bool repeatable;
}; };
extern PQueue(DebugCmdInfo) g_DebugCmdInfos; extern PQueue<DebugCmdInfo> g_DebugCmdInfos;
void init_global_dbg_constants (); void init_global_dbg_constants ();

View file

@ -77,12 +77,11 @@ int SteppingStoneEndpoint::DataSent(double t, uint64 seq, int len, int caplen,
while ( stp_manager->OrderedEndpoints().length() > 0 ) while ( stp_manager->OrderedEndpoints().length() > 0 )
{ {
int f = stp_manager->OrderedEndpoints().front(); auto e = stp_manager->OrderedEndpoints().front();
if ( stp_manager->OrderedEndpoints()[f]->stp_resume_time < tmin ) if ( e->stp_resume_time < tmin )
{ {
SteppingStoneEndpoint* e = stp_manager->OrderedEndpoints().pop_front();
stp_manager->OrderedEndpoints().pop_front();
e->Done(); e->Done();
Unref(e); Unref(e);
} }

View file

@ -13,8 +13,6 @@ namespace analyzer { namespace stepping_stone {
class SteppingStoneEndpoint; class SteppingStoneEndpoint;
class SteppingStoneManager; class SteppingStoneManager;
declare(PQueue,SteppingStoneEndpoint);
class SteppingStoneEndpoint : public BroObj { class SteppingStoneEndpoint : public BroObj {
public: public:
SteppingStoneEndpoint(tcp::TCP_Endpoint* e, SteppingStoneManager* m); SteppingStoneEndpoint(tcp::TCP_Endpoint* e, SteppingStoneManager* m);
@ -75,14 +73,14 @@ class SteppingStoneManager {
public: public:
SteppingStoneManager() { endp_cnt = 0; } SteppingStoneManager() { endp_cnt = 0; }
PQueue(SteppingStoneEndpoint)& OrderedEndpoints() PQueue<SteppingStoneEndpoint>& OrderedEndpoints()
{ return ordered_endps; } { return ordered_endps; }
// Use postfix ++, since the first ID needs to be even. // Use postfix ++, since the first ID needs to be even.
int NextID() { return endp_cnt++; } int NextID() { return endp_cnt++; }
protected: protected:
PQueue(SteppingStoneEndpoint) ordered_endps; PQueue<SteppingStoneEndpoint> ordered_endps;
int endp_cnt; int endp_cnt;
}; };