diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/structure/catalog/hashtab.h | 13 | ||||
-rw-r--r-- | src/mongo/db/structure/catalog/namespace_index.cpp | 8 |
2 files changed, 6 insertions, 15 deletions
diff --git a/src/mongo/db/structure/catalog/hashtab.h b/src/mongo/db/structure/catalog/hashtab.h index 72c15e2d7b6..07916dc873d 100644 --- a/src/mongo/db/structure/catalog/hashtab.h +++ b/src/mongo/db/structure/catalog/hashtab.h @@ -38,6 +38,7 @@ #include <map> #include "mongo/db/storage/mmap_v1/dur.h" #include "mongo/db/operation_context.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -163,7 +164,7 @@ namespace mongo { return true; } - typedef void (*IteratorCallback)( const Key& k , Type& v ); + typedef stdx::function< void ( const Key& k , Type& v ) > IteratorCallback; void iterAll( IteratorCallback callback ) { for ( int i=0; i<n; i++ ) { if ( nodes(i).inUse() ) { @@ -172,16 +173,6 @@ namespace mongo { } } - // TODO: should probably use stdx::bind for this, but didn't want to look at it - typedef void (*IteratorCallback2)( const Key& k , Type& v , void * extra ); - void iterAll( IteratorCallback2 callback , void * extra ) { - for ( int i=0; i<n; i++ ) { - if ( nodes(i).inUse() ) { - callback( nodes(i).k , nodes(i).value , extra ); - } - } - } - }; #pragma pack() diff --git a/src/mongo/db/structure/catalog/namespace_index.cpp b/src/mongo/db/structure/catalog/namespace_index.cpp index 118297c311d..af61ae68e54 100644 --- a/src/mongo/db/structure/catalog/namespace_index.cpp +++ b/src/mongo/db/structure/catalog/namespace_index.cpp @@ -106,18 +106,18 @@ namespace mongo { return ret; } - static void namespaceGetNamespacesCallback( const Namespace& k , NamespaceDetails& v , void * extra ) { - list<string> * l = (list<string>*)extra; + static void namespaceGetNamespacesCallback( const Namespace& k , NamespaceDetails& v , list<string>* l ) { if ( ! k.hasDollarSign() || k == "local.oplog.$main" ) { // we call out local.oplog.$main specifically as its the only "normal" // collection that has a $, so we make sure it gets added - l->push_back( (string)k ); + l->push_back( k.toString() ); } } void NamespaceIndex::getCollectionNamespaces( list<string>* tofill ) const { if ( _ht.get() ) - _ht->iterAll( namespaceGetNamespacesCallback , (void*)tofill ); + _ht->iterAll( stdx::bind( namespaceGetNamespacesCallback, + stdx::placeholders::_1, stdx::placeholders::_2, tofill) ); } void NamespaceIndex::maybeMkdir() const { |