mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-06 01:05:11 +00:00
Now that State Cases have been renamed, rename NodeCases back to Cases.
Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees@ubuntu.com>
This commit is contained in:
@@ -81,17 +81,15 @@ ostream &operator<<(ostream &os, const NodeSet &state);
|
|||||||
* (i.e., following an AnyCharNode or NotCharSetNode). This avoids
|
* (i.e., following an AnyCharNode or NotCharSetNode). This avoids
|
||||||
* enumerating all the explicit tranitions for default matches.
|
* enumerating all the explicit tranitions for default matches.
|
||||||
*/
|
*/
|
||||||
typedef struct NodeCases {
|
typedef struct Cases {
|
||||||
typedef map<uchar, NodeSet *>::iterator iterator;
|
typedef map<uchar, NodeSet *>::iterator iterator;
|
||||||
iterator begin() { return cases.begin(); }
|
iterator begin() { return cases.begin(); }
|
||||||
iterator end() { return cases.end(); }
|
iterator end() { return cases.end(); }
|
||||||
|
|
||||||
NodeCases(): otherwise(0) { }
|
Cases(): otherwise(0) { }
|
||||||
map<uchar, NodeSet *> cases;
|
map<uchar, NodeSet *> cases;
|
||||||
NodeSet *otherwise;
|
NodeSet *otherwise;
|
||||||
}
|
} Cases;
|
||||||
|
|
||||||
NodeCases;
|
|
||||||
|
|
||||||
ostream &operator<<(ostream &os, Node &node);
|
ostream &operator<<(ostream &os, Node &node);
|
||||||
|
|
||||||
@@ -205,7 +203,7 @@ public:
|
|||||||
ImportantNode(): LeafNode() { }
|
ImportantNode(): LeafNode() { }
|
||||||
void compute_firstpos() { firstpos.insert(this); }
|
void compute_firstpos() { firstpos.insert(this); }
|
||||||
void compute_lastpos() { lastpos.insert(this); }
|
void compute_lastpos() { lastpos.insert(this); }
|
||||||
virtual void follow(NodeCases &cases) = 0;
|
virtual void follow(Cases &cases) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* common base class for all the different classes that contain
|
/* common base class for all the different classes that contain
|
||||||
@@ -220,7 +218,7 @@ public:
|
|||||||
class CharNode: public CNode {
|
class CharNode: public CNode {
|
||||||
public:
|
public:
|
||||||
CharNode(uchar c): c(c) { }
|
CharNode(uchar c): c(c) { }
|
||||||
void follow(NodeCases &cases)
|
void follow(Cases &cases)
|
||||||
{
|
{
|
||||||
NodeSet **x = &cases.cases[c];
|
NodeSet **x = &cases.cases[c];
|
||||||
if (!*x) {
|
if (!*x) {
|
||||||
@@ -251,7 +249,7 @@ public:
|
|||||||
class CharSetNode: public CNode {
|
class CharSetNode: public CNode {
|
||||||
public:
|
public:
|
||||||
CharSetNode(Chars &chars): chars(chars) { }
|
CharSetNode(Chars &chars): chars(chars) { }
|
||||||
void follow(NodeCases &cases)
|
void follow(Cases &cases)
|
||||||
{
|
{
|
||||||
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) {
|
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) {
|
||||||
NodeSet **x = &cases.cases[*i];
|
NodeSet **x = &cases.cases[*i];
|
||||||
@@ -292,7 +290,7 @@ public:
|
|||||||
class NotCharSetNode: public CNode {
|
class NotCharSetNode: public CNode {
|
||||||
public:
|
public:
|
||||||
NotCharSetNode(Chars &chars): chars(chars) { }
|
NotCharSetNode(Chars &chars): chars(chars) { }
|
||||||
void follow(NodeCases & cases)
|
void follow(Cases &cases)
|
||||||
{
|
{
|
||||||
if (!cases.otherwise)
|
if (!cases.otherwise)
|
||||||
cases.otherwise = new NodeSet;
|
cases.otherwise = new NodeSet;
|
||||||
@@ -305,7 +303,7 @@ public:
|
|||||||
* the old otherwise state for the matching characters.
|
* the old otherwise state for the matching characters.
|
||||||
*/
|
*/
|
||||||
cases.otherwise->insert(followpos.begin(), followpos.end());
|
cases.otherwise->insert(followpos.begin(), followpos.end());
|
||||||
for (NodeCases::iterator i = cases.begin(); i != cases.end();
|
for (Cases::iterator i = cases.begin(); i != cases.end();
|
||||||
i++) {
|
i++) {
|
||||||
if (chars.find(i->first) == chars.end())
|
if (chars.find(i->first) == chars.end())
|
||||||
i->second->insert(followpos.begin(),
|
i->second->insert(followpos.begin(),
|
||||||
@@ -340,12 +338,12 @@ public:
|
|||||||
class AnyCharNode: public CNode {
|
class AnyCharNode: public CNode {
|
||||||
public:
|
public:
|
||||||
AnyCharNode() { }
|
AnyCharNode() { }
|
||||||
void follow(NodeCases &cases)
|
void follow(Cases &cases)
|
||||||
{
|
{
|
||||||
if (!cases.otherwise)
|
if (!cases.otherwise)
|
||||||
cases.otherwise = new NodeSet;
|
cases.otherwise = new NodeSet;
|
||||||
cases.otherwise->insert(followpos.begin(), followpos.end());
|
cases.otherwise->insert(followpos.begin(), followpos.end());
|
||||||
for (NodeCases::iterator i = cases.begin(); i != cases.end();
|
for (Cases::iterator i = cases.begin(); i != cases.end();
|
||||||
i++)
|
i++)
|
||||||
i->second->insert(followpos.begin(), followpos.end());
|
i->second->insert(followpos.begin(), followpos.end());
|
||||||
}
|
}
|
||||||
@@ -372,7 +370,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void follow(NodeCases &cases __attribute__ ((unused)))
|
void follow(Cases &cases __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
/* Nothing to follow. */
|
/* Nothing to follow. */
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ void DFA::update_state_transitions(NodeMap &nodemap, list<State *> &work_queue,
|
|||||||
* The resultant transition set is a mapping of characters to
|
* The resultant transition set is a mapping of characters to
|
||||||
* sets of nodes.
|
* sets of nodes.
|
||||||
*/
|
*/
|
||||||
NodeCases cases;
|
Cases cases;
|
||||||
for (NodeSet::iterator i = state->nodes->begin(); i != state->nodes->end(); i++)
|
for (NodeSet::iterator i = state->nodes->begin(); i != state->nodes->end(); i++)
|
||||||
(*i)->follow(cases);
|
(*i)->follow(cases);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ void DFA::update_state_transitions(NodeMap &nodemap, list<State *> &work_queue,
|
|||||||
/* For each transition from *from, check if the set of nodes it
|
/* For each transition from *from, check if the set of nodes it
|
||||||
* transitions to already has been mapped to a state
|
* transitions to already has been mapped to a state
|
||||||
*/
|
*/
|
||||||
for (NodeCases::iterator j = cases.begin(); j != cases.end(); j++) {
|
for (Cases::iterator j = cases.begin(); j != cases.end(); j++) {
|
||||||
State *target;
|
State *target;
|
||||||
target = find_target_state(nodemap, work_queue, j->second, stats);
|
target = find_target_state(nodemap, work_queue, j->second, stats);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user