[apparmor] [PATCH 1/3] Rename and invert logic of is_null to is_accept to better reflect its use
Steve Beattie
steve at nxnw.org
Thu Mar 22 19:18:14 UTC 2012
On Thu, Mar 22, 2012 at 11:44:53AM -0700, John Johansen wrote:
> Signed-off-by: John Johansen <john.johansen at canonical.com>
Acked-By: Steve Beattie <sbeattie at ubuntu.com>
> ---
> parser/libapparmor_re/hfa.cc | 14 +++++++-------
> parser/libapparmor_re/hfa.h | 4 ++--
> 2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/parser/libapparmor_re/hfa.cc b/parser/libapparmor_re/hfa.cc
> index 3e796ad..5ace9df 100644
> --- a/parser/libapparmor_re/hfa.cc
> +++ b/parser/libapparmor_re/hfa.cc
> @@ -340,7 +340,7 @@ void DFA::remove_unreachable(dfaflags_t flags)
> cerr << "unreachable: " << **i;
> if (*i == start)
> cerr << " <==";
> - if (!(*i)->perms.is_null())
> + if ((*i)->perms.is_accept())
> (*i)->perms.dump(cerr);
> cerr << "\n";
> }
> @@ -556,7 +556,7 @@ void DFA::minimize(dfaflags_t flags)
> (*i)->label = -1;
> rep->perms.add((*i)->perms);
> }
> - if (!rep->perms.is_null())
> + if (rep->perms.is_accept())
> final_accept++;
> //if ((*p)->size() > 1)
> //cerr << "\n";
> @@ -611,11 +611,11 @@ out:
> void DFA::dump(ostream & os)
> {
> for (Partition::iterator i = states.begin(); i != states.end(); i++) {
> - if (*i == start || !(*i)->perms.is_null()) {
> + if (*i == start || (*i)->perms.is_accept()) {
> os << **i;
> if (*i == start)
> os << " <== (allow/deny/audit/quiet)";
> - if (!(*i)->perms.is_null())
> + if ((*i)->perms.is_accept())
> (*i)->perms.dump(os);
> os << "\n";
> }
> @@ -631,7 +631,7 @@ void DFA::dump(ostream & os)
> excluded.insert(j->first);
> } else {
> os << **i;
> - if (!(*i)->perms.is_null())
> + if ((*i)->perms.is_accept())
> os << " ", (*i)->perms.dump(os);
> os << " -> " << *(j)->second << ": 0x"
> << hex << (int) j->first;
> @@ -643,7 +643,7 @@ void DFA::dump(ostream & os)
>
> if ((*i)->otherwise != nonmatching) {
> os << **i;
> - if (!(*i)->perms.is_null())
> + if ((*i)->perms.is_accept())
> os << " ", (*i)->perms.dump(os);
> os << " -> " << *(*i)->otherwise << ": [";
> if (!excluded.empty()) {
> @@ -677,7 +677,7 @@ void DFA::dump_dot_graph(ostream & os)
> if (*i == start) {
> os << "\t\tstyle=bold" << "\n";
> }
> - if (!(*i)->perms.is_null()) {
> + if ((*i)->perms.is_accept()) {
> os << "\t\tlabel=\"" << **i << "\\n";
> (*i)->perms.dump(os);
> os << "\"\n";
> diff --git a/parser/libapparmor_re/hfa.h b/parser/libapparmor_re/hfa.h
> index 73bbfc0..9e022a6 100644
> --- a/parser/libapparmor_re/hfa.h
> +++ b/parser/libapparmor_re/hfa.h
> @@ -43,7 +43,7 @@ class perms_t {
> public:
> perms_t(void) throw(int): allow(0), deny(0), audit(0), quiet(0), exact(0) { };
>
> - bool is_null(void) { return !(allow | audit | quiet); }
> + bool is_accept(void) { return (allow | audit | quiet); }
>
> void dump(ostream &os)
> {
> @@ -106,7 +106,7 @@ public:
> allow &= ~deny;
> quiet &= deny;
> deny = 0;
> - return is_null();
> + return !is_accept();
> }
> return 0;
> }
> --
> 1.7.9.1
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20120322/c0f2898a/attachment.pgp>
More information about the AppArmor
mailing list