From: Alex Rousskov Date: Tue, 28 May 2013 14:28:15 +0000 (-0600) Subject: SourceFormat X-Git-Tag: SQUID_3_4_0_1~102^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e936c41ce4d5c3daf74c2296accfb383de38b3ba;p=thirdparty%2Fsquid.git SourceFormat --- diff --git a/src/acl/Acl.cc b/src/acl/Acl.cc index 68e8440fe2..b5e1c31fd3 100644 --- a/src/acl/Acl.cc +++ b/src/acl/Acl.cc @@ -401,7 +401,6 @@ ACL::~ACL() AclMatchedName = NULL; // in case it was pointing to our name } - ACL::Prototype::Prototype() : prototype (NULL), typeString (NULL) {} ACL::Prototype::Prototype (ACL const *aPrototype, char const *aType) : prototype (aPrototype), typeString (aType) diff --git a/src/acl/Acl.h b/src/acl/Acl.h index f370563c8f..6b82937f44 100644 --- a/src/acl/Acl.h +++ b/src/acl/Acl.h @@ -89,10 +89,9 @@ public: static const ACLFlag NoFlags[1]; ///< An empty flags list }; - /// A configurable condition. A node in the ACL expression tree. /// Can evaluate itself in FilledChecklist context. -/// Does not change during evaluation. +/// Does not change during evaluation. /// \ingroup ACLAPI class ACL { diff --git a/src/acl/AllOf.cc b/src/acl/AllOf.cc index 57e67a3527..3e4cc32600 100644 --- a/src/acl/AllOf.cc +++ b/src/acl/AllOf.cc @@ -5,7 +5,6 @@ #include "globals.h" #include "MemBuf.h" - char const * Acl::AllOf::typeString() const { @@ -74,7 +73,7 @@ Acl::AllOf::parse() lineCtx.init(); lineCtx.Printf("(%s line #%d)", name, lineId); lineCtx.terminate(); - + Acl::AndNode *line = new AndNode; line->context(lineCtx.content(), config_input_line); line->lineParse(); diff --git a/src/acl/AllOf.h b/src/acl/AllOf.h index 7a7f4cebb5..1358303aa5 100644 --- a/src/acl/AllOf.h +++ b/src/acl/AllOf.h @@ -3,7 +3,8 @@ #include "acl/InnerNode.h" -namespace Acl { +namespace Acl +{ /// Configurable all-of ACL. Each ACL line is a conjuction of ACLs. /// Uses AndNode and OrNode to handle squid.conf configuration where multiple diff --git a/src/acl/AnyOf.h b/src/acl/AnyOf.h index e1536eeec8..cda920586f 100644 --- a/src/acl/AnyOf.h +++ b/src/acl/AnyOf.h @@ -3,7 +3,8 @@ #include "acl/BoolOps.h" -namespace Acl { +namespace Acl +{ /// Configurable any-of ACL. Each ACL line is a disjuction of ACLs. class AnyOf: public Acl::OrNode diff --git a/src/acl/Asn.cc b/src/acl/Asn.cc index 5084282811..ea03dd5912 100644 --- a/src/acl/Asn.cc +++ b/src/acl/Asn.cc @@ -641,9 +641,9 @@ ACLDestinationASNStrategy::match (ACLData * &data, ACLFilledChecklist return -1; // else fall through to noaddr match, hiding the lookup failure (XXX) } - Ip::Address noaddr; - noaddr.SetNoAddr(); - return data->match(noaddr); + Ip::Address noaddr; + noaddr.SetNoAddr(); + return data->match(noaddr); } ACLDestinationASNStrategy * diff --git a/src/acl/BoolOps.cc b/src/acl/BoolOps.cc index 7e48fc04d0..3b8c89f771 100644 --- a/src/acl/BoolOps.cc +++ b/src/acl/BoolOps.cc @@ -4,7 +4,6 @@ #include "Debug.h" #include "wordlist.h" - /* Acl::NotNode */ Acl::NotNode::NotNode(ACL *acl) @@ -20,7 +19,7 @@ Acl::NotNode::parse() { // Not implemented: by the time an upper level parser discovers // an '!' operator, there is nothing left for us to parse. - assert(false); + assert(false); } int @@ -61,7 +60,6 @@ Acl::NotNode::dump() const return text; } - /* Acl::AndNode */ char const * @@ -93,10 +91,9 @@ void Acl::AndNode::parse() { // Not implemented: AndNode cannot be configured directly. See Acl::AllOf. - assert(false); + assert(false); } - /* Acl::OrNode */ char const * diff --git a/src/acl/BoolOps.h b/src/acl/BoolOps.h index 316295a0d6..d06c8a94fc 100644 --- a/src/acl/BoolOps.h +++ b/src/acl/BoolOps.h @@ -7,7 +7,8 @@ * They cannot be specified directly in squid.conf because squid.conf ACLs are * more complex than (and are implemented using) these operator-like classes.*/ -namespace Acl { +namespace Acl +{ /// Implements the "not" or "!" operator. class NotNode: public InnerNode @@ -29,7 +30,6 @@ private: }; MEMPROXY_CLASS_INLINE(Acl::NotNode); - /// An inner ACL expression tree node representing a boolean conjuction (AND) /// operator applied to a list of child tree nodes. /// For example, conditions expressed on a single http_access line are ANDed. @@ -69,7 +69,6 @@ private: }; MEMPROXY_CLASS_INLINE(Acl::OrNode); - } // namespace Acl #endif /* SQUID_ACL_LOGIC_H */ diff --git a/src/acl/Checklist.cc b/src/acl/Checklist.cc index 279b452a51..6774c738e9 100644 --- a/src/acl/Checklist.cc +++ b/src/acl/Checklist.cc @@ -19,31 +19,31 @@ ACLChecklist::prepNonBlocking() return false; } - /** \par - * If the _acl_access is no longer valid (i.e. its been - * freed because of a reconfigure), then bail with ACCESS_DUNNO. - */ - - if (!cbdataReferenceValid(accessList)) { - cbdataReferenceDone(accessList); - debugs(28, 4, "ACLChecklist::check: " << this << " accessList is invalid"); - checkCallback(ACCESS_DUNNO); - return false; - } + /** \par + * If the _acl_access is no longer valid (i.e. its been + * freed because of a reconfigure), then bail with ACCESS_DUNNO. + */ - // If doNonBlocking() was called for a finished() checklist to call - // the callbacks, then do not try to match again. XXX: resumeNonBlockingCheck() should check for this instead. - if (!finished()) - return true; - - /** \par - * Either the request is allowed, denied, requires authentication. - */ - debugs(28, 3, this << " calling back with " << currentAnswer()); - cbdataReferenceDone(accessList); /* A */ - checkCallback(currentAnswer()); - /* From here on in, this may be invalid */ - return false; + if (!cbdataReferenceValid(accessList)) { + cbdataReferenceDone(accessList); + debugs(28, 4, "ACLChecklist::check: " << this << " accessList is invalid"); + checkCallback(ACCESS_DUNNO); + return false; + } + + // If doNonBlocking() was called for a finished() checklist to call + // the callbacks, then do not try to match again. XXX: resumeNonBlockingCheck() should check for this instead. + if (!finished()) + return true; + + /** \par + * Either the request is allowed, denied, requires authentication. + */ + debugs(28, 3, this << " calling back with " << currentAnswer()); + cbdataReferenceDone(accessList); /* A */ + checkCallback(currentAnswer()); + /* From here on in, this may be invalid */ + return false; } void @@ -139,7 +139,7 @@ ACLChecklist::goAsync(AsyncState *state) asyncStage_ = asyncNone; // sanity restored return false; } - + // yes, we must pause until the async callback calls resumeNonBlockingCheck asyncStage_ = asyncRunning; return true; @@ -275,7 +275,8 @@ ACLChecklist::resumeNonBlockingCheck(AsyncState *state) /// performs (or resumes) an ACL tree match and, if successful, sets the action void -ACLChecklist::matchAndFinish() { +ACLChecklist::matchAndFinish() +{ bool result = false; if (matchPath.empty()) { result = accessList->matches(this); @@ -284,7 +285,7 @@ ACLChecklist::matchAndFinish() { matchPath.pop(); result = top.parent->resumeMatchingAt(this, top.position); } - + if (result) // the entire tree matched markFinished(accessList->winningAction(), "match"); } @@ -358,7 +359,7 @@ ACLChecklist::calcImplicitAnswer() { // XXX: rename lastSeenAction after review and before commit const allow_t lastSeenAction = (accessList && cbdataReferenceValid(accessList)) ? - accessList->lastAction() : allow_t(ACCESS_DUNNO); + accessList->lastAction() : allow_t(ACCESS_DUNNO); allow_t implicitRuleAnswer = ACCESS_DUNNO; if (lastSeenAction == ACCESS_DENIED) // reverse last seen "deny" implicitRuleAnswer = ACCESS_ALLOWED; diff --git a/src/acl/Checklist.h b/src/acl/Checklist.h index ee56f90ed7..c94e4eb826 100644 --- a/src/acl/Checklist.h +++ b/src/acl/Checklist.h @@ -157,7 +157,7 @@ public: /// Otherwise, returns false; the caller is expected to handle the failure. bool goAsync(AsyncState *); - /// Matches (or resumes matching of) a child node while maintaning + /// Matches (or resumes matching of) a child node while maintaning /// resumption breadcrumbs if a [grand]child node goes async. bool matchChild(const Acl::InnerNode *parent, Acl::Nodes::const_iterator pos, const ACL *child); @@ -201,7 +201,8 @@ public: private: /* internal methods */ /// Position of a child node within an ACL tree. - class Breadcrumb { + class Breadcrumb + { public: Breadcrumb(): parent(NULL) {} Breadcrumb(const Acl::InnerNode *aParent, Acl::Nodes::const_iterator aPos): parent(aParent), position(aPos) {} diff --git a/src/acl/Gadgets.h b/src/acl/Gadgets.h index 12852a20b1..19a131ced2 100644 --- a/src/acl/Gadgets.h +++ b/src/acl/Gadgets.h @@ -25,7 +25,8 @@ void aclParseAclList(ConfigParser &parser, Acl::Tree **, const char *label); /// Template to convert various context lables to strings. \ingroup ACLAPI template inline -void aclParseAclList(ConfigParser &parser, Acl::Tree **tree, const Any any) { +void aclParseAclList(ConfigParser &parser, Acl::Tree **tree, const Any any) +{ std::ostringstream buf; buf << any; aclParseAclList(parser, tree, buf.str().c_str()); diff --git a/src/acl/InnerNode.cc b/src/acl/InnerNode.cc index 98d62dcfed..df091d9d15 100644 --- a/src/acl/InnerNode.cc +++ b/src/acl/InnerNode.cc @@ -11,9 +11,9 @@ #include "wordlist.h" #include - // "delete acl" class to use with std::for_each() in InnerNode::~InnerNode() -class AclDeleter { +class AclDeleter +{ public: void operator()(ACL* acl) { // Do not delete explicit ACLs; they are maintained by Config.aclList. @@ -22,7 +22,6 @@ public: } }; - Acl::InnerNode::~InnerNode() { std::for_each(nodes.begin(), nodes.end(), AclDeleter()); diff --git a/src/acl/InnerNode.h b/src/acl/InnerNode.h index 832ab73556..6f3b14446b 100644 --- a/src/acl/InnerNode.h +++ b/src/acl/InnerNode.h @@ -4,7 +4,8 @@ #include "acl/Acl.h" #include -namespace Acl { +namespace Acl +{ typedef std::vector Nodes; ///< a collection of nodes diff --git a/src/acl/Tree.cc b/src/acl/Tree.cc index 79bd58d808..3a416aea27 100644 --- a/src/acl/Tree.cc +++ b/src/acl/Tree.cc @@ -4,7 +4,6 @@ CBDATA_NAMESPACED_CLASS_INIT(Acl, Tree); - allow_t Acl::Tree::winningAction() const { @@ -61,7 +60,7 @@ Acl::Tree::treeDump(const char *prefix, const ActionToString &convert) const if (action != actions.end()) { const char *act = convert ? convert[action->kind] : - (*action == ACCESS_ALLOWED ? "allow" : "deny"); + (*action == ACCESS_ALLOWED ? "allow" : "deny"); wordlistAdd(&text, act ? act : "???"); ++action; } diff --git a/src/acl/Tree.h b/src/acl/Tree.h index c244dafee9..a372839192 100644 --- a/src/acl/Tree.h +++ b/src/acl/Tree.h @@ -3,7 +3,8 @@ #include "acl/BoolOps.h" -namespace Acl { +namespace Acl +{ /// An ORed set of rules at the top of the ACL expression tree, providing two /// unique properties: cbdata protection and optional rule actions. @@ -38,7 +39,6 @@ private: CBDATA_CLASS2(Tree); }; - } // namespace Acl #endif /* SQUID_ACL_TREE_H */ diff --git a/src/acl/forward.h b/src/acl/forward.h index 4c5f39b216..32b28cbd7b 100644 --- a/src/acl/forward.h +++ b/src/acl/forward.h @@ -10,8 +10,8 @@ class AclAddress; class AclDenyInfoList; class AclSizeLimit; - -namespace Acl { +namespace Acl +{ class InnerNode; class NotNode;