Skip to content

Commit 9f5e3d4

Browse files
committed
Remove STATWRITER_NAMESPACE namespacing
Prior to C++11 we had to jump through some hoops to allow multiple (identical) declarations of the same template name. This is no longer necessary, so simplify the code to remove these extra defines / namespacing. Change-Id: I6bd5e4cee97fafb327c1f357d629bbd28ffb96f5 Reviewed-on: http://review.couchbase.org/82694 Reviewed-by: Trond Norbye <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 5d6f17a commit 9f5e3d4

File tree

9 files changed

+4
-32
lines changed

9 files changed

+4
-32
lines changed

engines/ep/src/checkpoint.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
#include "ep_engine.h"
2727
#include "ep_time.h"
2828
#include "pre_link_document_context.h"
29-
#define STATWRITER_NAMESPACE checkpoint
3029
#include "statwriter.h"
31-
#undef STATWRITER_NAMESPACE
3230
#include "vbucket.h"
3331

3432
const std::string CheckpointManager::pCursorName("persistence");

engines/ep/src/configuration.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
#ifdef AUTOCONF_BUILD
2626
#include "generated_configuration.cc"
2727
#endif
28-
29-
#define STATWRITER_NAMESPACE config
3028
#include "statwriter.h"
31-
#undef STATWRITER_NAMESPACE
3229

3330
// Used to get a name from a type to use in logging
3431
template <typename T>

engines/ep/src/couch-kvstore/couch-kvstore.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@
4747
#include "couch-kvstore/couch-kvstore.h"
4848
#include "ep_types.h"
4949
#include "kvstore_config.h"
50-
#define STATWRITER_NAMESPACE couchstore_engine
5150
#include "statwriter.h"
52-
#undef STATWRITER_NAMESPACE
5351
#include "vbucket.h"
5452
#include "vbucket_bgfetch_item.h"
5553

engines/ep/src/ep_engine.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
#include "memory_tracker.h"
3737
#include "replicationthrottle.h"
3838
#include "stats-info.h"
39-
#define STATWRITER_NAMESPACE core_engine
4039
#include "statwriter.h"
41-
#undef STATWRITER_NAMESPACE
4240
#include "string_utils.h"
4341
#include "vb_count_visitor.h"
4442
#include "warmup.h"

engines/ep/src/failover-table.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222
#include "atomic.h"
2323
#include "failover-table.h"
24-
#define STATWRITER_NAMESPACE failovers
2524
#include "statwriter.h"
26-
#undef STATWRITER_NAMESPACE
2725

2826
FailoverTable::FailoverTable(size_t capacity)
2927
: max_entries(capacity), erroneousEntriesErased(0), provider(true) {

engines/ep/src/forest-kvstore/forest-kvstore.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
#include <vbucket.h>
2626
#include <JSON_checker.h>
2727
#include <locks.h>
28-
29-
#define STATWRITER_NAMESPACE forestdb_engine
3028
#include "statwriter.h"
31-
#undef STATWRITER_NAMESPACE
3229

3330
std::mutex ForestKVStore::initLock;
3431
int ForestKVStore::numGlobalFiles = 0;

engines/ep/src/statwriter.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,21 @@
1515
* limitations under the License.
1616
*/
1717

18-
#ifndef SRC_STATWRITER_H_
19-
#define SRC_STATWRITER_H_ 1
18+
#pragma once
2019

2120
#include "config.h"
2221

22+
#include "objectregistry.h"
2323

24-
#include <atomic>
24+
#include <memcached/engine_common.h>
2525
#include <platform/histogram.h>
2626
#include <platform/sized_buffer.h>
27-
#include "objectregistry.h"
2827

28+
#include <atomic>
2929
#include <cstring>
30-
#include <memcached/engine_common.h>
3130

3231
class EventuallyPersistentEngine;
3332

34-
namespace STATWRITER_NAMESPACE {
35-
3633
inline void add_casted_stat(const char *k, const char *v,
3734
ADD_STAT add_stat, const void *cookie) {
3835
EventuallyPersistentEngine *e = ObjectRegistry::onSwitchThread(NULL, true);
@@ -113,9 +110,3 @@ void add_prefixed_stat(P prefix, const char *nm, Histogram<T> &val,
113110

114111
add_casted_stat(name.str().c_str(), val, add_stat, cookie);
115112
}
116-
117-
}
118-
119-
using namespace STATWRITER_NAMESPACE;
120-
121-
#endif // SRC_STATWRITER_H_

engines/ep/src/vbucket.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@
3333
#include "flusher.h"
3434
#include "pre_link_document_context.h"
3535
#include "vbucketdeletiontask.h"
36-
37-
#define STATWRITER_NAMESPACE vbucket
3836
#include "statwriter.h"
39-
#undef STATWRITER_NAMESPACE
4037
#include "stored_value_factories.h"
4138

4239
#include "vbucket.h"

engines/ep/src/warmup.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
#include "ep_vb.h"
2424
#include "failover-table.h"
2525
#include "mutation_log.h"
26-
#define STATWRITER_NAMESPACE warmup
2726
#include "statwriter.h"
28-
#undef STATWRITER_NAMESPACE
2927
#include "vbucket_bgfetch_item.h"
3028

3129
#include <platform/make_unique.h>

0 commit comments

Comments
 (0)