summaryrefslogtreecommitdiff
path: root/src/mongo/db/pdfile.h
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2012-10-22 13:03:17 -0400
committerTad Marshall <tad@10gen.com>2012-10-23 17:01:51 -0400
commit001e3afa1a06b800d800c4bf70f1e45738a154a5 (patch)
tree77c14782df5841bce6ab353ecfb5540e2b53bfcd /src/mongo/db/pdfile.h
parent2716c5467a5c171d6af5cfcbda5e63508e48f6ef (diff)
downloadmongo-001e3afa1a06b800d800c4bf70f1e45738a154a5.tar.gz
SERVER-7439 remove unused parameter and redundant routine
Remove the unused 'len' parameter from DataFileMgr::makeDeletedRecord(), make it call MongoDataFile::recordAt() instead of MongoDataFile::makeRecord(). Remove the now-unused MongoDataFile::makeRecord(). Set nextDeleted to Null in Extent::init() for completeness (it would get set when the deleted record was added to a deleted list, so this isn't strictly required). Clean up the code slightly (reinterpret_cast instead of C-style cast).
Diffstat (limited to 'src/mongo/db/pdfile.h')
-rw-r--r--src/mongo/db/pdfile.h29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/mongo/db/pdfile.h b/src/mongo/db/pdfile.h
index 00833077793..984ea5cfa1e 100644
--- a/src/mongo/db/pdfile.h
+++ b/src/mongo/db/pdfile.h
@@ -100,8 +100,7 @@ namespace mongo {
Extent* getExtent(DiskLoc loc) const;
Extent* _getExtent(DiskLoc loc) const;
- Record* recordAt(DiskLoc dl);
- Record* makeRecord(DiskLoc dl, int size);
+ Record* recordAt(DiskLoc dl) const;
void grow(DiskLoc dl, int size);
char* p() const { return (char *) _mb; }
@@ -152,7 +151,7 @@ namespace mongo {
static Extent* getExtent(const DiskLoc& dl);
static Record* getRecord(const DiskLoc& dl);
- static DeletedRecord* makeDeletedRecord(const DiskLoc& dl, int len);
+ static DeletedRecord* getDeletedRecord(const DiskLoc& dl);
void deleteRecord(const char *ns, Record *todelete, const DiskLoc& dl, bool cappedOK = false, bool noWarn = false, bool logOp=false);
@@ -492,16 +491,12 @@ namespace mongo {
namespace mongo {
- inline Record* MongoDataFile::recordAt(DiskLoc dl) {
+ inline Record* MongoDataFile::recordAt(DiskLoc dl) const {
int ofs = dl.getOfs();
- if( ofs < DataFileHeader::HeaderSize ) badOfs(ofs); // will uassert - external call to keep out of the normal code path
- return (Record*) (p()+ofs);
- }
-
- inline Record* MongoDataFile::makeRecord(DiskLoc dl, int size) {
- int ofs = dl.getOfs();
- if( ofs < DataFileHeader::HeaderSize ) badOfs(ofs); // will uassert - external call to keep out of the normal code path
- return (Record*) (p()+ofs);
+ if (ofs < DataFileHeader::HeaderSize) {
+ badOfs(ofs); // will uassert - external call to keep out of the normal code path
+ }
+ return reinterpret_cast<Record*>(p() + ofs);
}
inline DiskLoc Record::getNext(const DiskLoc& myLoc) {
@@ -599,16 +594,14 @@ namespace mongo {
}
inline Record* DataFileMgr::getRecord(const DiskLoc& dl) {
- verify( dl.a() != -1 );
- Record* r = cc().database()->getFile(dl.a())->recordAt(dl);
- return r;
+ verify(dl.a() != -1);
+ return cc().database()->getFile(dl.a())->recordAt(dl);
}
BOOST_STATIC_ASSERT( 16 == sizeof(DeletedRecord) );
- inline DeletedRecord* DataFileMgr::makeDeletedRecord(const DiskLoc& dl, int len) {
- verify( dl.a() != -1 );
- return (DeletedRecord*) cc().database()->getFile(dl.a())->makeRecord(dl, sizeof(DeletedRecord));
+ inline DeletedRecord* DataFileMgr::getDeletedRecord(const DiskLoc& dl) {
+ return reinterpret_cast<DeletedRecord*>(getRecord(dl));
}
void ensureHaveIdIndex(const char *ns);