mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
remove use of template in initializer
This commit is contained in:
parent
371dcdc94e
commit
dcc917a1bf
2 changed files with 8 additions and 3 deletions
|
@ -166,7 +166,7 @@ void CPPCompile::InitializeConsts() {
|
|||
StartBlock();
|
||||
|
||||
for ( const auto& c : consts )
|
||||
Emit("CPP_ValElem(%s, %s),", TypeTagName(c.first), Fmt(c.second));
|
||||
Emit("{%s, %s},", TypeTagName(c.first), Fmt(c.second));
|
||||
|
||||
EndBlock(true);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,12 @@ public:
|
|||
};
|
||||
|
||||
// Convenient way to refer to an offset associated with a particular Zeek type.
|
||||
using CPP_ValElem = std::pair<TypeTag, int>;
|
||||
// A "struct" rather than a std::pair because C++ compilers are terribly slow
|
||||
// at initializing large numbers of the latter.
|
||||
struct CPP_ValElem {
|
||||
TypeTag tag;
|
||||
int offset;
|
||||
};
|
||||
|
||||
// This class groups together all of the vectors needed for run-time
|
||||
// initialization. We gather them together into a single object so as
|
||||
|
@ -57,7 +62,7 @@ public:
|
|||
// index.
|
||||
ValPtr ConstVals(int offset) const {
|
||||
auto& cv = const_vals[offset];
|
||||
return Consts(cv.first, cv.second);
|
||||
return Consts(cv.tag, cv.offset);
|
||||
}
|
||||
|
||||
// Retrieves the Zeek constant value for a particular Zeek type.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue