Skip to content

Commit 21ad4ff

Browse files
committed
Cleanup.
1 parent d320233 commit 21ad4ff

6 files changed

Lines changed: 35 additions & 25 deletions

File tree

include/react/Defs.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@
55
#define REACT_END }
66
#define REACT ::react
77

8-
#define REACT_IMPL_BEGIN REACT_BEGIN namespace impl {
8+
#define REACT_IMPL_BEGIN REACT_BEGIN namespace impl {
99
#define REACT_IMPL_END REACT_END }
1010
#define REACT_IMPL REACT ::impl
1111

12+
#ifdef _DEBUG
13+
#define REACT_MESSAGE(...) printf(__VA_ARGS__ ## "\n")
14+
#else
15+
#define REACT_MESSAGE
16+
#endif
17+
18+
// Assert with message
19+
#define REACT_ASSERT(condition, ...) for (; !(condition); assert(condition)) printf(__VA_ARGS__ ## "\n")
20+
1221
////////////////////////////////////////////////////////////////////////////////////////
22+
// Type aliases
1323
REACT_BEGIN
1424

15-
typedef unsigned int uint;
16-
typedef unsigned char uchar;
25+
using uint = unsigned int;
26+
using uchar = unsigned char;
1727

1828
REACT_END

include/react/common/Concurrency.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#pragma once
22

3+
#include "react/Defs.h"
4+
35
#include <mutex>
46
#include <condition_variable>
57

6-
namespace react {
8+
REACT_BEGIN
79

810
class BlockingCondition
911
{
@@ -70,4 +72,4 @@ class BlockingCondition
7072
bool blocked_ = false;
7173
};
7274

73-
} // ~namespace react
75+
REACT_END

include/react/common/Containers.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#pragma once
22

3-
#include <vector>
4-
#include <array>
3+
#include "react/Defs.h"
4+
55
#include <algorithm>
6+
#include <array>
7+
#include <vector>
68

79
////////////////////////////////////////////////////////////////////////////////////////
8-
namespace react {
10+
REACT_BEGIN
911

1012
////////////////////////////////////////////////////////////////////////////////////////
1113
/// NodeVector
@@ -80,4 +82,4 @@ class NodePtrBuffer
8082
DataT nodes_;
8183
};
8284

83-
} // ~namespace react
85+
REACT_END

include/react/common/SourceIdSet.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#pragma once
22

3+
#include "react/Defs.h"
4+
35
#include <algorithm>
46
#include <vector>
57

68
#include "tbb/queuing_mutex.h"
79

810
////////////////////////////////////////////////////////////////////////////////////////
9-
namespace react {
11+
REACT_BEGIN
1012

1113
////////////////////////////////////////////////////////////////////////////////////////
1214
/// SourceIdSet
@@ -120,4 +122,4 @@ class SourceIdSet
120122
}
121123
};
122124

123-
} // ~namespace react
125+
REACT_END

include/react/common/TopoQueue.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#pragma once
22

3+
#include "react/Defs.h"
4+
35
#include <algorithm>
46
#include <array>
57
#include <vector>
68

79
////////////////////////////////////////////////////////////////////////////////////////
8-
namespace react {
10+
REACT_BEGIN
911

1012
////////////////////////////////////////////////////////////////////////////////////////
1113
/// TopoQueue
@@ -50,4 +52,4 @@ class TopoQueue
5052
std::vector<T*> data_;
5153
};
5254

53-
} // ~namespace react
55+
REACT_END

include/react/common/Util.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include "react/Defs.h"
4+
35
#include <assert.h>
46
#include <cstddef>
57
#include <ctime>
@@ -11,16 +13,7 @@
1113
#include <utility>
1214

1315
////////////////////////////////////////////////////////////////////////////////////////
14-
namespace react {
15-
16-
#ifdef _DEBUG
17-
#define REACT_MESSAGE(...) printf(__VA_ARGS__ ## "\n")
18-
#else
19-
#define MESSAGE
20-
#endif
21-
22-
// Assert with message
23-
#define REACT_ASSERT(condition, ...) for (; !(condition); assert(condition)) printf(__VA_ARGS__ ## "\n")
16+
REACT_BEGIN
2417

2518
////////////////////////////////////////////////////////////////////////////////////////
2619
/// NonCopyable
@@ -147,5 +140,4 @@ struct Identity
147140
typedef T Type;
148141
};
149142

150-
// ---
151-
}
143+
REACT_END

0 commit comments

Comments
 (0)