0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

some asserts

This commit is contained in:
Eliot Horowitz 2008-04-01 17:58:33 -04:00
parent 042da8c2ab
commit de0a31a3f0
3 changed files with 7 additions and 1 deletions

View File

@ -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() )

View File

@ -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;

View File

@ -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);
}
}