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

cleanup namespace pollution SERVER-1042

This commit is contained in:
Mathias Stearn 2010-04-23 14:19:55 -04:00
parent 32c403d752
commit 1d746cc4ca
4 changed files with 10 additions and 7 deletions

View File

@ -149,11 +149,9 @@ namespace mongo {
*/
class BSONSizeTracker {
public:
#define BSONSizeTrackerSize 10
BSONSizeTracker(){
_pos = 0;
for ( int i=0; i<BSONSizeTrackerSize; i++ )
for ( int i=0; i<SIZE; i++ )
_sizes[i] = 512; // this is the default, so just be consistent
}
@ -162,7 +160,7 @@ namespace mongo {
void got( int size ){
_sizes[_pos++] = size;
if ( _pos >= BSONSizeTrackerSize )
if ( _pos >= SIZE )
_pos = 0;
}
@ -171,7 +169,7 @@ namespace mongo {
*/
int getSize() const {
int x = 16; // sane min
for ( int i=0; i<BSONSizeTrackerSize; i++ ){
for ( int i=0; i<SIZE; i++ ){
if ( _sizes[i] > x )
x = _sizes[i];
}
@ -179,8 +177,9 @@ namespace mongo {
}
private:
enum { SIZE = 10 };
int _pos;
int _sizes[BSONSizeTrackerSize];
int _sizes[SIZE];
};
}

View File

@ -176,6 +176,7 @@ namespace mongo {
_buf.grow( 1 )[0] = c;
return *this;
}
#undef SBNUM
void append( const char * str ){
int x = strlen( str );

View File

@ -115,7 +115,6 @@ namespace mongo {
};
extern Nullstream nullstream;
#define LOGIT { ss << x; return *this; }
class Logstream : public Nullstream {
static mongo::mutex mutex;
@ -134,6 +133,7 @@ namespace mongo {
}
ss.str("");
}
#define LOGIT { ss << x; return *this; }
Logstream& operator<<(const char *x) LOGIT
Logstream& operator<<(char *x) LOGIT
Logstream& operator<<(char x) LOGIT
@ -148,6 +148,7 @@ namespace mongo {
Logstream& operator<<(long long x) LOGIT
Logstream& operator<<(unsigned long long x) LOGIT
Logstream& operator<<(bool x) LOGIT
#undef LOGIT
Logstream& operator<<(const LazyString& x) {
ss << x.val();
return *this;

View File

@ -275,4 +275,6 @@ namespace mongo {
static ListeningSockets* _instance;
};
#undef SOCK_FAMILY_UNKNOWN_ERROR
} // namespace mongo