From: wessels <> Date: Sat, 21 Apr 2007 04:17:06 +0000 (+0000) Subject: Removed some uses of RefCount::getRaw() X-Git-Tag: SQUID_3_0_PRE6~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=94a396a3bf0f8158ef1f74b375a142cfc8d39df4;p=thirdparty%2Fsquid.git Removed some uses of RefCount::getRaw() 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. --- diff --git a/src/client_side.cc b/src/client_side.cc index 279e0fbbe3..ad614e8632 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.749 2007/04/20 07:29:47 wessels Exp $ + * $Id: client_side.cc,v 1.750 2007/04/20 22:17:06 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -167,7 +167,7 @@ int ClientSocketContext::fd() const { assert (http); - assert (http->getConn().getRaw() != NULL); + assert (http->getConn() != NULL); return http->getConn()->fd; } @@ -214,8 +214,8 @@ void ClientSocketContext::removeFromConnectionList(ConnStateData::Pointer conn) { ClientSocketContext::Pointer *tempContextPointer; - assert(conn.getRaw() != NULL); - assert(conn->getCurrentContext().getRaw() != NULL); + assert(conn != NULL); + assert(conn->getCurrentContext() != NULL); /* Unlink us from the connection request list */ tempContextPointer = & conn->currentobject; @@ -259,7 +259,7 @@ ClientSocketContext::registerWithConn() { assert (!connRegistered_); assert (http); - assert (http->getConn().getRaw() != NULL); + assert (http->getConn() != NULL); connRegistered_ = true; http->getConn()->addContextToQueue(this); } @@ -276,7 +276,7 @@ void ClientSocketContext::connIsFinished() { assert (http); - assert (http->getConn().getRaw() != NULL); + assert (http->getConn() != NULL); deRegisterWithConn(); /* we can't handle any more stream data - detach */ clientStreamDetach(getTail(), http); @@ -494,7 +494,7 @@ ClientHttpRequest::logRequest() if (loggingEntry() && loggingEntry()->mem_obj) al.cache.objectSize = loggingEntry()->contentLen(); - al.cache.caddr = getConn().getRaw() != NULL ? getConn()->log_addr : no_addr; + al.cache.caddr = getConn() != NULL ? getConn()->log_addr : no_addr; al.cache.size = out.size; @@ -507,12 +507,12 @@ ClientHttpRequest::logRequest() if (request) clientPrepareLogWithRequestDetails(request, &al); - if (getConn().getRaw() != NULL && getConn()->rfc931[0]) + if (getConn() != NULL && getConn()->rfc931[0]) al.cache.rfc931 = getConn()->rfc931; #if USE_SSL - if (getConn().getRaw() != NULL) + if (getConn() != NULL) al.cache.ssluser = sslGetUserEmail(fd_table[getConn()->fd].ssl); #endif @@ -527,7 +527,7 @@ ClientHttpRequest::logRequest() accessLogLog(&al, checklist); updateCounters(); - if (getConn().getRaw() != NULL) + if (getConn() != NULL) clientdbUpdate(getConn()->peer.sin_addr, logType, PROTO_HTTP, out.size); } @@ -615,7 +615,7 @@ ConnStateData::close() bool ConnStateData::isOpen() const { - return openReference.getRaw() != NULL; + return openReference != NULL; } ConnStateData::~ConnStateData() @@ -711,7 +711,7 @@ clientIsRequestBodyTooLargeForPolicy(size_t bodyLength) int connIsUsable(ConnStateData::Pointer conn) { - if (conn.getRaw() == NULL || conn->fd == -1) + if (conn == NULL || conn->fd == -1) return 0; return 1; @@ -1245,7 +1245,7 @@ clientSocketRecipient(clientStreamNode * node, ClientHttpRequest * http, assert(cbdataReferenceValid(node)); assert(node->node.next == NULL); ClientSocketContext::Pointer context = dynamic_cast(node->data.getRaw()); - assert(context.getRaw() != NULL); + assert(context != NULL); assert(connIsUsable(http->getConn())); fd = http->getConn()->fd; /* TODO: check offset is what we asked for */ diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 245acbe858..3c17cdce6d 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.117 2007/04/17 05:40:18 wessels Exp $ + * $Id: client_side_reply.cc,v 1.118 2007/04/20 22:17:06 wessels Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -274,7 +274,7 @@ clientReplyContext::processExpired() * A refcounted pointer so that FwdState stays around as long as * this clientReplyContext does */ - FwdState::fwdStart(http->getConn().getRaw() != NULL ? http->getConn()->fd : -1, + FwdState::fwdStart(http->getConn() != NULL ? http->getConn()->fd : -1, http->storeEntry(), http->request); /* Register with storage manager to receive updates when data comes in. */ @@ -720,7 +720,7 @@ clientReplyContext::processMiss() if (http->flags.internal) r->protocol = PROTO_INTERNAL; - FwdState::fwdStart(http->getConn().getRaw() != NULL ? http->getConn()->fd : -1, + FwdState::fwdStart(http->getConn() != NULL ? http->getConn()->fd : -1, http->storeEntry(), r); } @@ -1051,7 +1051,7 @@ clientHttpRequestStatus(int fd, ClientHttpRequest const *http) debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); debug(88, 1) ("\tclient %s\n", - inet_ntoa(http->getConn().getRaw() != NULL ? http->getConn()->peer.sin_addr : no_addr)); + inet_ntoa(http->getConn() != NULL ? http->getConn()->peer.sin_addr : no_addr)); debug(88, 1) ("\treceived %d bytes\n", (int) http->out.size); debug(88, 1) ("\tURI %s\n", http->log_uri); return 1; @@ -1063,7 +1063,7 @@ clientHttpRequestStatus(int fd, ClientHttpRequest const *http) debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); debug(88, 1) ("\tclient %s\n", - inet_ntoa(http->getConn().getRaw() != NULL ? http->getConn()->peer.sin_addr : no_addr)); + inet_ntoa(http->getConn() != NULL ? http->getConn()->peer.sin_addr : no_addr)); debug(88, 1) ("\treceived %d bytes (offset %d)\n", (int) http->out.size, (int) http->out.offset); debug(88, 1) ("\tURI %s\n", http->log_uri); @@ -1754,7 +1754,7 @@ clientReplyContext::processReplyAccess () if (http->isReplyBodyTooLarge(reply->content_length)) { ErrorState *err = clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL, - http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, + http->getConn() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request); removeClientStoreReference(&sc, http); HTTPMSGUNLOCK(reply); @@ -1798,7 +1798,7 @@ clientReplyContext::processReplyAccessResult(bool accessAllowed) err = clientBuildError(page_id, HTTP_FORBIDDEN, NULL, - http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, + http->getConn() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request); removeClientStoreReference(&sc, http); @@ -1897,7 +1897,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result) ConnStateData::Pointer conn = http->getConn(); - int fd = conn.getRaw() != NULL ? conn->fd : -1; + int fd = conn != NULL ? conn->fd : -1; char *buf = next()->readBuffer.data; diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 5242f30d46..855d1010ee 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.80 2007/04/06 04:50:06 rousskov Exp $ + * $Id: client_side_request.cc,v 1.81 2007/04/20 22:17:06 wessels Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -414,7 +414,7 @@ ClientRequestContext::clientAccessCheckDone(int answer) AclMatchedName ? AclMatchedName : "NO ACL's"); char const *proxy_auth_msg = ""; - if (http->getConn().getRaw() != NULL && http->getConn()->auth_user_request != NULL) + if (http->getConn() != NULL && http->getConn()->auth_user_request != NULL) proxy_auth_msg = http->getConn()->auth_user_request->denyMessage(""); else if (http->request->auth_user_request != NULL) proxy_auth_msg = http->request->auth_user_request->denyMessage(""); @@ -463,8 +463,8 @@ ClientRequestContext::clientAccessCheckDone(int answer) assert (repContext); repContext->setReplyToError(page_id, status, http->request->method, NULL, - http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request, - NULL, http->getConn().getRaw() != NULL + http->getConn() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request, + NULL, http->getConn() != NULL && http->getConn()->auth_user_request ? http->getConn()-> auth_user_request : http->request->auth_user_request); node = (clientStreamNode *)http->client_stream.tail->data; @@ -736,13 +736,13 @@ clientInterpretRequestHeaders(ClientHttpRequest * http) #if USE_USERAGENT_LOG if ((str = req_hdr->getStr(HDR_USER_AGENT))) - logUserAgent(fqdnFromAddr(http->getConn().getRaw() ? http->getConn()->log_addr : no_addr), str); + logUserAgent(fqdnFromAddr(http->getConn() != NULL ? http->getConn()->log_addr : no_addr), str); #endif #if USE_REFERER_LOG if ((str = req_hdr->getStr(HDR_REFERER))) - logReferer(fqdnFromAddr(http->getConn().getRaw() ? http->getConn()->log_addr : no_addr), str, http->log_uri); + logReferer(fqdnFromAddr(http->getConn() != NULL ? http->getConn()->log_addr : no_addr), str, http->log_uri); #endif #if FORW_VIA_DB