summaryrefslogtreecommitdiff
path: root/db/storage.h
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-12-17 12:23:06 -0500
committerDwight <dmerriman@gmail.com>2008-12-17 12:23:06 -0500
commit1d8082574af3844607a882b8d953cd1843235509 (patch)
tree77d8a9d5a212e45a9d52558061c731d18342eb16 /db/storage.h
parent1c29b8aae48c16600141242f8c2754a5475070c3 (diff)
downloadmongo-1d8082574af3844607a882b8d953cd1843235509.tar.gz
clean up compare for diskloc class a little had some dup code
Diffstat (limited to 'db/storage.h')
-rw-r--r--db/storage.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/db/storage.h b/db/storage.h
index 2ce70926c10..5e4f43f77f3 100644
--- a/db/storage.h
+++ b/db/storage.h
@@ -89,14 +89,9 @@ public:
int x = fileNo - b.fileNo;
if( x )
return x;
- if( ofs == b.ofs ) return 0;
- return ofs < b.ofs ? -1 : 1;
- }
- bool operator<(const DiskLoc& b) const {
- if( fileNo == b.fileNo )
- return ofs < b.ofs;
- return fileNo < b.fileNo;
+ return ofs - b.ofs;
}
+ bool operator<(const DiskLoc& b) const { return compare(b) < 0; }
/* get the "thing" associated with this disk location.
it is assumed the object is what it is -- you must asure that: