mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
some asserts
This commit is contained in:
parent
042da8c2ab
commit
de0a31a3f0
@ -510,7 +510,7 @@ string JSObj::toString() const {
|
|||||||
|
|
||||||
/* well ordered compare */
|
/* well ordered compare */
|
||||||
int JSObj::woCompare(const JSObj& r) const {
|
int JSObj::woCompare(const JSObj& r) const {
|
||||||
|
assert( _objdata );
|
||||||
if( isEmpty() )
|
if( isEmpty() )
|
||||||
return r.isEmpty() ? 0 : -1;
|
return r.isEmpty() ? 0 : -1;
|
||||||
if( r.isEmpty() )
|
if( r.isEmpty() )
|
||||||
|
@ -235,6 +235,9 @@ explicit
|
|||||||
((JSObj&)r)._objdata = 0;
|
((JSObj&)r)._objdata = 0;
|
||||||
((JSObj&)r).iFree = false;
|
((JSObj&)r).iFree = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert( _objsize == 0 || _objdata );
|
||||||
|
|
||||||
}
|
}
|
||||||
JSObj& operator=(JSObj& r) {
|
JSObj& operator=(JSObj& r) {
|
||||||
if( iFree ) free((void*)_objdata);
|
if( iFree ) free((void*)_objdata);
|
||||||
@ -325,6 +328,7 @@ public:
|
|||||||
/* assume ownership of the buffer - you must then free it (with free()) */
|
/* assume ownership of the buffer - you must then free it (with free()) */
|
||||||
char* decouple(int& l) {
|
char* decouple(int& l) {
|
||||||
char *x = _done();
|
char *x = _done();
|
||||||
|
assert( x );
|
||||||
l = b.len();
|
l = b.len();
|
||||||
b.decouple();
|
b.decouple();
|
||||||
return x;
|
return x;
|
||||||
|
@ -540,8 +540,10 @@ void IndexDetails::getKeysFromObject(JSObj& obj, set<JSObj>& keys) {
|
|||||||
Element e = i.next();
|
Element e = i.next();
|
||||||
if( e.eoo() ) break;
|
if( e.eoo() ) break;
|
||||||
JSObjBuilder b;
|
JSObjBuilder b;
|
||||||
|
|
||||||
b.appendAs(e, f.fieldName());
|
b.appendAs(e, f.fieldName());
|
||||||
JSObj o = b.doneAndDecouple();
|
JSObj o = b.doneAndDecouple();
|
||||||
|
assert( o.objdata() );
|
||||||
keys.insert(o);
|
keys.insert(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user