mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Older C++ compilers complain about the use of a class with a non trivial
constructor in a union. Change the ProtoState class to use an init fn instead of a constructor.
This commit is contained in:
parent
2347b6628d
commit
41b454f2e5
@ -101,7 +101,8 @@ State *DFA::add_new_state(NodeSet *nodes, State *other)
|
|||||||
nnodev = nnodes_cache.insert(nnodes);
|
nnodev = nnodes_cache.insert(nnodes);
|
||||||
anodes = anodes_cache.insert(anodes);
|
anodes = anodes_cache.insert(anodes);
|
||||||
|
|
||||||
ProtoState proto(nnodev, anodes);
|
ProtoState proto;
|
||||||
|
proto.init(nnodev, anodes);
|
||||||
State *state = new State(node_map.size(), proto, other);
|
State *state = new State(node_map.size(), proto, other);
|
||||||
pair<NodeMap::iterator,bool> x = node_map.insert(proto, state);
|
pair<NodeMap::iterator,bool> x = node_map.insert(proto, state);
|
||||||
if (x.second == false) {
|
if (x.second == false) {
|
||||||
|
@ -310,7 +310,15 @@ public:
|
|||||||
hashedNodeVec *nnodes;
|
hashedNodeVec *nnodes;
|
||||||
NodeSet *anodes;
|
NodeSet *anodes;
|
||||||
|
|
||||||
ProtoState(hashedNodeVec *n, NodeSet *a = NULL): nnodes(n), anodes(a) { };
|
/* init is used instead of a constructor because ProtoState is used
|
||||||
|
* in a union
|
||||||
|
*/
|
||||||
|
void init(hashedNodeVec *n, NodeSet *a = NULL)
|
||||||
|
{
|
||||||
|
nnodes = n;
|
||||||
|
anodes = a;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator<(ProtoState const &rhs)const
|
bool operator<(ProtoState const &rhs)const
|
||||||
{
|
{
|
||||||
if (nnodes == rhs.nnodes)
|
if (nnodes == rhs.nnodes)
|
||||||
@ -338,7 +346,7 @@ public:
|
|||||||
* parition: Is a temporary work variable used during dfa minimization.
|
* parition: Is a temporary work variable used during dfa minimization.
|
||||||
* it can be replaced with a map, but that is slower and uses more
|
* it can be replaced with a map, but that is slower and uses more
|
||||||
* memory.
|
* memory.
|
||||||
* nodes: Is a temporary work variable used during dfa creation. It can
|
* proto: Is a temporary work variable used during dfa creation. It can
|
||||||
* be replaced by using the nodemap, but that is slower
|
* be replaced by using the nodemap, but that is slower
|
||||||
*/
|
*/
|
||||||
class State {
|
class State {
|
||||||
@ -379,8 +387,8 @@ public:
|
|||||||
|
|
||||||
/* temp storage for State construction */
|
/* temp storage for State construction */
|
||||||
union {
|
union {
|
||||||
Partition *partition;
|
Partition *partition; /* used during minimization */
|
||||||
ProtoState proto;
|
ProtoState proto; /* used during creation */
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user