mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 09:06:21 +01:00
some asserts
This commit is contained in:
parent
042da8c2ab
commit
de0a31a3f0
@ -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() )
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user