2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 10:07:12 +00:00

convert anodes to using NodeVecs instead of NodeSets

Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2021-01-30 02:32:38 -08:00
parent 53d00b4d2b
commit 61c20a0ae8
2 changed files with 9 additions and 9 deletions

View File

@ -303,12 +303,12 @@ static void split_node_types(NodeSet *nodes, NodeSet **anodes, NodeSet **nnodes
State *DFA::add_new_state(NodeSet *anodes, NodeSet *nnodes, State *other)
{
NodeVec *nnodev;
NodeVec *nnodev, *anodev;
nnodev = nnodes_cache.insert(nnodes);
anodes = anodes_cache.insert(anodes);
anodev = anodes_cache.insert(anodes);
ProtoState proto;
proto.init(nnodev, anodes);
proto.init(nnodev, anodev);
State *state = new State(node_map.size(), proto, other, filedfa);
pair<NodeMap::iterator,bool> x = node_map.insert(proto, state);
if (x.second == false) {
@ -1340,7 +1340,7 @@ static inline int diff_qualifiers(uint32_t perm1, uint32_t perm2)
* have any exact matches, then they override the execute and safe
* execute flags.
*/
int accept_perms(NodeSet *state, perms_t &perms, bool filedfa)
int accept_perms(NodeVec *state, perms_t &perms, bool filedfa)
{
int error = 0;
uint32_t exact_match_allow = 0;
@ -1351,7 +1351,7 @@ int accept_perms(NodeSet *state, perms_t &perms, bool filedfa)
if (!state)
return error;
for (NodeSet::iterator i = state->begin(); i != state->end(); i++) {
for (NodeVec::iterator i = state->begin(); i != state->end(); i++) {
if (!(*i)->is_type(NODE_TYPE_MATCHFLAG))
continue;

View File

@ -133,7 +133,7 @@ public:
uint32_t allow, deny, audit, quiet, exact;
};
int accept_perms(NodeSet *state, perms_t &perms, bool filedfa);
int accept_perms(NodeVec *state, perms_t &perms, bool filedfa);
/*
* ProtoState - NodeSet and ancillery information used to create a state
@ -141,12 +141,12 @@ int accept_perms(NodeSet *state, perms_t &perms, bool filedfa);
class ProtoState {
public:
NodeVec *nnodes;
NodeSet *anodes;
NodeVec *anodes;
/* init is used instead of a constructor because ProtoState is used
* in a union
*/
void init(NodeVec *n, NodeSet *a = NULL)
void init(NodeVec *n, NodeVec *a = NULL)
{
nnodes = n;
anodes = a;
@ -312,7 +312,7 @@ class DFA {
unsigned int &max);
/* temporary values used during computations */
NodeCache anodes_cache;
NodeVecCache anodes_cache;
NodeVecCache nnodes_cache;
NodeMap node_map;
list<State *> work_queue;