diff options
author | Aaron <aaron@10gen.com> | 2009-01-15 10:17:11 -0500 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2009-01-15 10:17:11 -0500 |
commit | 90d45238aa5fccb6dbdf0b40dfcf5823695d4643 (patch) | |
tree | 7a95e901512b890eb06309af2edd0da9c88b7279 /stdafx.cpp | |
parent | 938c2c07a8032259527b8e9cbb6d0d12c7e8867a (diff) | |
download | mongo-90d45238aa5fccb6dbdf0b40dfcf5823695d4643.tar.gz |
Indent all lines within namespaces one level
Diffstat (limited to 'stdafx.cpp')
-rw-r--r-- | stdafx.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/stdafx.cpp b/stdafx.cpp index b4485e281f5..1985bb94f79 100644 --- a/stdafx.cpp +++ b/stdafx.cpp @@ -25,7 +25,7 @@ namespace mongo { // TODO: reference any additional headers you need in STDAFX.H // and not in this file -Assertion lastAssert[4]; + Assertion lastAssert[4]; #undef assert @@ -38,64 +38,64 @@ Assertion lastAssert[4]; namespace mongo { -string getDbContext(); - -/* "warning" assert -- safe to continue, so we don't throw exception. */ -void wasserted(const char *msg, const char *file, unsigned line) { - problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; - sayDbContext(); - raiseError(msg && *msg ? msg : "wassertion failure"); - lastAssert[1].set(msg, getDbContext().c_str(), file, line); -} - -void asserted(const char *msg, const char *file, unsigned line) { - problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; - sayDbContext(); - raiseError(msg && *msg ? msg : "assertion failure"); - lastAssert[0].set(msg, getDbContext().c_str(), file, line); - throw AssertionException(); -} - -int uacount = 0; -void uasserted(const char *msg) { - if ( ++uacount < 100 ) - problem() << "User Assertion " << msg << endl; - else - RARELY problem() << "User Assertion " << msg << endl; - lastAssert[3].set(msg, getDbContext().c_str(), "", 0); - raiseError(msg); - throw UserAssertionException(msg); -} - -void msgasserted(const char *msg) { - log() << "Assertion: " << msg << '\n'; - lastAssert[2].set(msg, getDbContext().c_str(), "", 0); - raiseError(msg && *msg ? msg : "massert failure"); - throw MsgAssertionException(msg); -} - -string Assertion::toString() { - if ( !isSet() ) - return ""; - - stringstream ss; - ss << msg << '\n'; - if ( *context ) - ss << context << '\n'; - if ( *file ) - ss << file << ' ' << line << '\n'; - return ss.str(); -} - -/* this is a good place to set a breakpoint when debugging, as lots of warning things - (assert, wassert) call it. -*/ -void sayDbContext(const char *errmsg) { - if ( errmsg ) { - problem() << errmsg << endl; + string getDbContext(); + + /* "warning" assert -- safe to continue, so we don't throw exception. */ + void wasserted(const char *msg, const char *file, unsigned line) { + problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; + sayDbContext(); + raiseError(msg && *msg ? msg : "wassertion failure"); + lastAssert[1].set(msg, getDbContext().c_str(), file, line); + } + + void asserted(const char *msg, const char *file, unsigned line) { + problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; + sayDbContext(); + raiseError(msg && *msg ? msg : "assertion failure"); + lastAssert[0].set(msg, getDbContext().c_str(), file, line); + throw AssertionException(); + } + + int uacount = 0; + void uasserted(const char *msg) { + if ( ++uacount < 100 ) + problem() << "User Assertion " << msg << endl; + else + RARELY problem() << "User Assertion " << msg << endl; + lastAssert[3].set(msg, getDbContext().c_str(), "", 0); + raiseError(msg); + throw UserAssertionException(msg); + } + + void msgasserted(const char *msg) { + log() << "Assertion: " << msg << '\n'; + lastAssert[2].set(msg, getDbContext().c_str(), "", 0); + raiseError(msg && *msg ? msg : "massert failure"); + throw MsgAssertionException(msg); + } + + string Assertion::toString() { + if ( !isSet() ) + return ""; + + stringstream ss; + ss << msg << '\n'; + if ( *context ) + ss << context << '\n'; + if ( *file ) + ss << file << ' ' << line << '\n'; + return ss.str(); + } + + /* this is a good place to set a breakpoint when debugging, as lots of warning things + (assert, wassert) call it. + */ + void sayDbContext(const char *errmsg) { + if ( errmsg ) { + problem() << errmsg << endl; + } + printStackTrace(); } - printStackTrace(); -} } // namespace mongo |