summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <erh@ERH-OFC-MP.local>2008-04-01 17:58:33 -0400
committerEliot Horowitz <erh@ERH-OFC-MP.local>2008-04-01 17:58:33 -0400
commitde0a31a3f02ab58adce174be27ba6d6b126b5726 (patch)
treee2bc4b84d18bf8f598265f08f8af2aba906875fb
parent042da8c2ab15dfc6886846a90150ea8a9ecfc8bb (diff)
downloadmongo-de0a31a3f02ab58adce174be27ba6d6b126b5726.tar.gz
some asserts
-rw-r--r--db/jsobj.cpp2
-rw-r--r--db/jsobj.h4
-rw-r--r--db/pdfile.cpp2
3 files changed, 7 insertions, 1 deletions
diff --git a/db/jsobj.cpp b/db/jsobj.cpp
index cdae3ffeed7..e600af83317 100644
--- a/db/jsobj.cpp
+++ b/db/jsobj.cpp
@@ -510,7 +510,7 @@ string JSObj::toString() const {
/* well ordered compare */
int JSObj::woCompare(const JSObj& r) const {
-
+ assert( _objdata );
if( isEmpty() )
return r.isEmpty() ? 0 : -1;
if( r.isEmpty() )
diff --git a/db/jsobj.h b/db/jsobj.h
index 46ba252f43f..15267054510 100644
--- a/db/jsobj.h
+++ b/db/jsobj.h
@@ -235,6 +235,9 @@ explicit
((JSObj&)r)._objdata = 0;
((JSObj&)r).iFree = false;
}
+
+ assert( _objsize == 0 || _objdata );
+
}
JSObj& operator=(JSObj& r) {
if( iFree ) free((void*)_objdata);
@@ -325,6 +328,7 @@ public:
/* assume ownership of the buffer - you must then free it (with free()) */
char* decouple(int& l) {
char *x = _done();
+ assert( x );
l = b.len();
b.decouple();
return x;
diff --git a/db/pdfile.cpp b/db/pdfile.cpp
index 9c53860ccb7..c1048833041 100644
--- a/db/pdfile.cpp
+++ b/db/pdfile.cpp
@@ -540,8 +540,10 @@ void IndexDetails::getKeysFromObject(JSObj& obj, set<JSObj>& keys) {
Element e = i.next();
if( e.eoo() ) break;
JSObjBuilder b;
+
b.appendAs(e, f.fieldName());
JSObj o = b.doneAndDecouple();
+ assert( o.objdata() );
keys.insert(o);
}
}