]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed some uses of RefCount::getRaw()
authorwessels <>
Sat, 21 Apr 2007 04:24:07 +0000 (04:24 +0000)
committerwessels <>
Sat, 21 Apr 2007 04:24:07 +0000 (04:24 +0000)
We can compare RefCount pointers to NULL without using getRaw() as long
as the RefCount pointer is on the left, and NULL is on the right.

src/ACLChecklist.cc
src/ACLIdent.cc
src/ACLProxyAuth.cc
src/AuthUserRequest.cc
src/DelayId.cc
src/DelayPool.cc

index ed26e9ff21dc3b73b84334e0a726e6c54de74424..3e6fa4428b4c7ffd3d01e4ea66bbf90ed292572a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLChecklist.cc,v 1.34 2006/05/18 21:51:10 wessels Exp $
+ * $Id: ACLChecklist.cc,v 1.35 2007/04/20 22:24:07 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -235,7 +235,7 @@ ACLChecklist::checkCallback(allow_t answer)
         /* the checklist lock */
         auth_user_request->unlock();
         /* it might have been connection based */
-        assert(conn().getRaw() != NULL);
+        assert(conn() != NULL);
         conn()->auth_user_request = NULL;
         conn()->auth_type = AUTH_BROKEN;
         auth_user_request = NULL;
@@ -371,7 +371,7 @@ ACLChecklist::conn()
 void
 ACLChecklist::conn(ConnStateData::Pointer aConn)
 {
-    assert (conn().getRaw() == NULL);
+    assert (conn() == NULL);
     conn_ = aConn;
 }
 
index e764e16ab318a0aec4f04a2154cad42efe2ffac8..18a5e4583f43fca4e548aa61afe851115aefa844 100644 (file)
@@ -82,7 +82,7 @@ ACLIdent::match(ACLChecklist *checklist)
 {
     if (checklist->rfc931[0]) {
         return data->match(checklist->rfc931);
-    } else if (checklist->conn().getRaw() != NULL && checklist->conn()->rfc931[0]) {
+    } else if (checklist->conn() != NULL && checklist->conn()->rfc931[0]) {
         return data->match(checklist->conn()->rfc931);
     } else {
         debug(28, 3) ("ACLIdent::match() - switching to ident lookup state\n");
@@ -125,7 +125,7 @@ IdentLookup::Instance()
 void
 IdentLookup::checkForAsync(ACLChecklist *checklist)const
 {
-    if (checklist->conn().getRaw() != NULL) {
+    if (checklist->conn() != NULL) {
         debug(28, 3) ("IdentLookup::checkForAsync: Doing ident lookup\n");
         checklist->asyncInProgress(true);
         identStart(&checklist->conn()->me, &checklist->conn()->peer,
@@ -153,7 +153,7 @@ IdentLookup::LookupDone(const char *ident, void *data)
      * Cache the ident result in the connection, to avoid redoing ident lookup
      * over and over on persistent connections
      */
-    if (checklist->conn().getRaw() != NULL && !checklist->conn()->rfc931[0])
+    if (checklist->conn() != NULL && !checklist->conn()->rfc931[0])
         xstrncpy(checklist->conn()->rfc931, checklist->rfc931, USER_IDENT_SZ);
 
     checklist->asyncInProgress(false);
index c0a456f5e95118aaac723e2f4b89bb56b2414612..efba6a53118b69a917202c8f8926a61fc08f1ec6 100644 (file)
@@ -163,7 +163,7 @@ ProxyAuthLookup::LookupDone(void *data, char *result)
         /* OR the connection was closed, there's no way to continue */
         checklist->auth_user_request->unlock();
 
-        if (checklist->conn().getRaw() != NULL) {
+        if (checklist->conn() != NULL) {
             checklist->conn()->auth_user_request = NULL;
             checklist->conn()->auth_type = AUTH_BROKEN;
         }
index 25e3353ceca89ace4ec27ad764990caf71585a3c..357d25d650073b4bc371627a3ef175b4b6e2eb8e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: AuthUserRequest.cc,v 1.11 2007/01/03 12:57:47 hno Exp $
+ * $Id: AuthUserRequest.cc,v 1.12 2007/04/20 22:24:07 wessels Exp $
  *
  * DO NOT MODIFY NEXT 2 LINES:
  * arch-tag: 6803fde1-d5a2-4c29-9034-1c0c9f650eb4
@@ -298,7 +298,7 @@ authTryGetUser (auth_user_request_t **auth_user_request, ConnStateData::Pointer
         return *auth_user_request;
     else if (request != NULL && request->auth_user_request)
         return request->auth_user_request;
-    else if (conn.getRaw() != NULL)
+    else if (conn != NULL)
         return conn->auth_user_request;
     else
         return NULL;
@@ -340,13 +340,13 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
      */
 
     if (((proxy_auth == NULL) && (!authenticateUserAuthenticated(authTryGetUser(auth_user_request,conn,request))))
-            || (conn.getRaw() != NULL  && conn->auth_type == AUTH_BROKEN))
+            || (conn != NULL  && conn->auth_type == AUTH_BROKEN))
     {
         /* no header or authentication failed/got corrupted - restart */
         debug(29, 4) ("authenticateAuthenticate: broken auth or no proxy_auth header. Requesting auth header.\n");
         /* something wrong with the AUTH credentials. Force a new attempt */
 
-        if (conn.getRaw() != NULL) {
+        if (conn != NULL) {
             conn->auth_type = AUTH_UNKNOWN;
 
             if (conn->auth_user_request)
@@ -369,7 +369,7 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
      * No check for function required in the if: its compulsory for conn based 
      * auth modules
      */
-    if (proxy_auth && conn.getRaw() != NULL && conn->auth_user_request &&
+    if (proxy_auth && conn != NULL && conn->auth_user_request &&
             authenticateUserAuthenticated(conn->auth_user_request) &&
             conn->auth_user_request->connLastHeader() != NULL &&
             strcmp(proxy_auth, conn->auth_user_request->connLastHeader()))
@@ -398,9 +398,9 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
     if (*auth_user_request == NULL)
     {
         debug(29, 9) ("authenticateAuthenticate: This is a new checklist test on FD:%d\n",
-                      conn.getRaw() != NULL ? conn->fd : -1);
+                      conn != NULL ? conn->fd : -1);
 
-        if (proxy_auth && !request->auth_user_request && conn.getRaw() && conn->auth_user_request) {
+        if (proxy_auth && !request->auth_user_request && conn != NULL && conn->auth_user_request) {
             AuthConfig * scheme = AuthConfig::Find(proxy_auth);
 
             if (!conn->auth_user_request->user() || conn->auth_user_request->user()->config != scheme) {
@@ -413,7 +413,7 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
         }
 
         if ((!request->auth_user_request)
-                && (conn.getRaw() == NULL || conn->auth_type == AUTH_UNKNOWN)) {
+                && (conn == NULL || conn->auth_type == AUTH_UNKNOWN)) {
             /* beginning of a new request check */
             debug(29, 4) ("authenticateAuthenticate: no connection authentication type\n");
 
@@ -451,7 +451,7 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
 
             ;
         } else {
-            assert (conn.getRaw() != NULL);
+            assert (conn != NULL);
 
             if (conn->auth_user_request != NULL) {
                 *auth_user_request = conn->auth_user_request;
index a6684fe7562bb0505754216c5662e1c846c7ba34..28fc96146e7d2431cebb2e848c33ee108315c6a3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: DelayId.cc,v 1.19 2006/02/17 18:10:59 wessels Exp $
+ * $Id: DelayId.cc,v 1.20 2007/04/20 22:24:07 wessels Exp $
  *
  * DEBUG: section 77    Delay Pools
  * AUTHOR: Robert Collins <robertc@squid-cache.org>
@@ -109,7 +109,7 @@ DelayId::DelayClient(ClientHttpRequest * http)
         ch.my_addr = r->my_addr;
         ch.my_port = r->my_port;
 
-        if (http->getConn().getRaw() != NULL)
+        if (http->getConn() != NULL)
             ch.conn(http->getConn());
 
         ch.request = HTTPMSGLOCK(r);
@@ -155,7 +155,7 @@ DelayId::bytesWanted(int minimum, int maximum) const
     /* limited */
     int nbytes = max(minimum, maximum);
 
-    if (compositeId.getRaw())
+    if (compositeId != NULL)
         nbytes = compositeId->bytesWanted(minimum, nbytes);
 
     return nbytes;
@@ -177,14 +177,14 @@ DelayId::bytesIn(int qty)
 
     assert ((unsigned short)(pool() - 1) != 0xFFFF);
 
-    if (compositeId.getRaw())
+    if (compositeId != NULL)
         compositeId->bytesIn(qty);
 }
 
 void
 DelayId::delayRead(DeferredRead const &aRead)
 {
-    assert (compositeId.getRaw());
+    assert (compositeId != NULL);
     compositeId->delayRead(aRead);
 
 }
index 5e9b783c68d2dec05bd5c59a80ed49aee3136a80..4dc8ed73c884f63440b896c9d43b7112fef88a45 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: DelayPool.cc,v 1.5 2003/08/04 22:14:40 robertc Exp $
+ * $Id: DelayPool.cc,v 1.6 2007/04/20 22:24:07 wessels Exp $
  *
  * DEBUG: section 77    Delay Pools
  * AUTHOR: Robert Collins <robertc@squid-cache.org>
@@ -62,14 +62,14 @@ DelayPool::~DelayPool()
 void
 DelayPool::parse()
 {
-    assert (theComposite().getRaw());
+    assert (theComposite() != NULL);
     theComposite()->parse();
 }
 
 void
 DelayPool::dump (StoreEntry *entry, unsigned int i) const
 {
-    if (!theComposite().getRaw())
+    if (!theComposite() != NULL)
         return;
 
     storeAppendPrintf(entry, "delay_class %d %s\n", i + 1, pool->theClassTypeLabel());