0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

fix warning

This commit is contained in:
Eliot Horowitz 2009-12-06 01:08:19 -05:00
parent 066236ad58
commit bca215f030
2 changed files with 4 additions and 12 deletions

View File

@ -29,10 +29,8 @@ namespace mongo {
CursorIterator::CursorIterator( auto_ptr<Cursor> c , BSONObj filter )
: _cursor( c ){
if ( filter.isEmpty() )
_matcher = 0;
else
_matcher = new KeyValJSMatcher( filter , BSONObj() );
if ( ! filter.isEmpty() )
_matcher.reset( new KeyValJSMatcher( filter , BSONObj() ) );
_advance();
}
@ -55,7 +53,7 @@ namespace mongo {
while ( _cursor->ok() ){
_o = _cursor->current();
_cursor->advance();
if ( _matcher == 0 || _matcher->matches( _o ) )
if ( _matcher.get() == 0 || _matcher->matches( _o ) )
return;
}

View File

@ -35,12 +35,6 @@ namespace mongo {
class CursorIterator {
public:
CursorIterator( auto_ptr<Cursor> c , BSONObj filter = BSONObj() );
~CursorIterator(){
if ( _matcher ){
delete _matcher;
_matcher = 0;
}
}
BSONObj next();
bool hasNext();
@ -48,8 +42,8 @@ namespace mongo {
void _advance();
auto_ptr<Cursor> _cursor;
auto_ptr<KeyValJSMatcher> _matcher;
BSONObj _o;
KeyValJSMatcher * _matcher;
};
/**