[svn] commit: r2121 - /branches/trac192/src/lib/datasrc/cache.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jun 15 23:28:36 UTC 2010
Author: jinmei
Date: Tue Jun 15 23:28:36 2010
New Revision: 2121
Log:
cleanups:
- removed redundant blank lines
- removed unnecessary header file
- style consistency
- constify
Modified:
branches/trac192/src/lib/datasrc/cache.cc
Modified: branches/trac192/src/lib/datasrc/cache.cc
==============================================================================
--- branches/trac192/src/lib/datasrc/cache.cc (original)
+++ branches/trac192/src/lib/datasrc/cache.cc Tue Jun 15 23:28:36 2010
@@ -14,9 +14,7 @@
// $Id$
-#include "cache.h"
-
-#include <stdio.h>
+#include <datasrc/cache.h>
using namespace std;
using namespace isc::dns;
@@ -25,11 +23,11 @@
namespace datasrc {
// CacheNode constructors
-CacheNode::CacheNode(const isc::dns::RRsetPtr rrset, const uint32_t flags,
+CacheNode::CacheNode(const RRsetPtr rrset, const uint32_t flags,
const time_t interval) :
qname(rrset->getName()), qclass(rrset->getClass()), qtype(rrset->getType())
{
- time_t now = time(NULL);
+ const time_t now = time(NULL);
expiry_ = now + interval;
entry_ = CacheEntryPtr(new CacheEntry);
@@ -40,14 +38,14 @@
next = CacheNodePtr();
}
-CacheNode::CacheNode(const isc::dns::Name& name,
- const isc::dns::RRClass& rrclass,
- const isc::dns::RRType& rrtype,
+CacheNode::CacheNode(const Name& name,
+ const RRClass& rrclass,
+ const RRType& rrtype,
const uint32_t flags,
const time_t interval) :
qname(name), qclass(rrclass), qtype(rrtype)
{
- time_t now = time(NULL);
+ const time_t now = time(NULL);
expiry_ = now + interval;
entry_ = CacheEntryPtr(new CacheEntry);
@@ -63,7 +61,7 @@
bool
CacheNode::isValid() const {
- time_t now = time(NULL);
+ const time_t now = time(NULL);
return (now < expiry_);
}
@@ -84,11 +82,10 @@
lru_head_ = lru_tail_ = CacheNodePtr();
}
-
ConstCacheNodePtr
HotCache::retrieve(Name n, RRClass c, RRType t) {
CacheNodePtr node = map_[QTuple(n, c, t)];
- if (! node) {
+ if (!node) {
return (CacheNodePtr());
}
@@ -159,14 +156,12 @@
}
int
-HotCache::getSlots() const
-{
+HotCache::getSlots() const {
return (slots_);
}
int
-HotCache::getCount() const
-{
+HotCache::getCount() const {
return (count_);
}
@@ -223,4 +218,3 @@
}
}
-
More information about the bind10-changes
mailing list