Skip to content

Commit 1698b47

Browse files
zamazan4ikjbeder
authored andcommitted
Use nullptr instead of 0 or NULL (clang-tidy warns) (#603)
1 parent 0f9a586 commit 1698b47

9 files changed

Lines changed: 15 additions & 15 deletions

src/contrib/graphbuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void* BuildGraphOfNextDocument(Parser& parser,
1111
if (parser.HandleNextDocument(eventHandler)) {
1212
return eventHandler.RootNode();
1313
} else {
14-
return NULL;
14+
return nullptr;
1515
}
1616
}
1717
}

src/contrib/graphbuilderadapter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void GraphBuilderAdapter::OnMapStart(const Mark &mark, const std::string &tag,
4949
EmitterStyle::value /* style */) {
5050
void *pNode = m_builder.NewMap(mark, tag, GetCurrentParent());
5151
m_containers.push(ContainerFrame(pNode, m_pKeyNode));
52-
m_pKeyNode = NULL;
52+
m_pKeyNode = nullptr;
5353
RegisterAnchor(anchor, pNode);
5454
}
5555

@@ -62,7 +62,7 @@ void GraphBuilderAdapter::OnMapEnd() {
6262

6363
void *GraphBuilderAdapter::GetCurrentParent() const {
6464
if (m_containers.empty()) {
65-
return NULL;
65+
return nullptr;
6666
}
6767
return m_containers.top().pContainer;
6868
}
@@ -83,7 +83,7 @@ void GraphBuilderAdapter::DispositionNode(void *pNode) {
8383
if (m_containers.top().isMap()) {
8484
if (m_pKeyNode) {
8585
m_builder.AssignInMap(pContainer, m_pKeyNode, pNode);
86-
m_pKeyNode = NULL;
86+
m_pKeyNode = nullptr;
8787
} else {
8888
m_pKeyNode = pNode;
8989
}

src/contrib/graphbuilderadapter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace YAML {
2626
class GraphBuilderAdapter : public EventHandler {
2727
public:
2828
GraphBuilderAdapter(GraphBuilderInterface& builder)
29-
: m_builder(builder), m_pRootNode(NULL), m_pKeyNode(NULL) {}
29+
: m_builder(builder), m_pRootNode(nullptr), m_pKeyNode(nullptr) {}
3030

3131
virtual void OnDocumentStart(const Mark& mark) { (void)mark; }
3232
virtual void OnDocumentEnd() {}

src/node_data.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,15 @@ void node_data::insert(node& key, node& value, shared_memory_holder pMemory) {
197197
// indexing
198198
node* node_data::get(node& key, shared_memory_holder /* pMemory */) const {
199199
if (m_type != NodeType::Map) {
200-
return NULL;
200+
return nullptr;
201201
}
202202

203203
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
204204
if (it->first->is(key))
205205
return it->second;
206206
}
207207

208-
return NULL;
208+
return nullptr;
209209
}
210210

211211
node& node_data::get(node& key, shared_memory_holder pMemory) {

src/nodebuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ namespace YAML {
1111
struct Mark;
1212

1313
NodeBuilder::NodeBuilder()
14-
: m_pMemory(new detail::memory_holder), m_pRoot(0), m_mapDepth(0) {
15-
m_anchors.push_back(0); // since the anchors start at 1
14+
: m_pMemory(new detail::memory_holder), m_pRoot(nullptr), m_mapDepth(0) {
15+
m_anchors.push_back(nullptr); // since the anchors start at 1
1616
}
1717

1818
NodeBuilder::~NodeBuilder() {}

src/ostream_wrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace YAML {
88
ostream_wrapper::ostream_wrapper()
99
: m_buffer(1, '\0'),
10-
m_pStream(0),
10+
m_pStream(nullptr),
1111
m_pos(0),
1212
m_row(0),
1313
m_col(0),

src/scanner.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Scanner::IndentMarker* Scanner::PushIndentTo(int column,
282282
IndentMarker::INDENT_TYPE type) {
283283
// are we in flow?
284284
if (InFlowContext()) {
285-
return 0;
285+
return nullptr;
286286
}
287287

288288
std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type));
@@ -291,12 +291,12 @@ Scanner::IndentMarker* Scanner::PushIndentTo(int column,
291291

292292
// is this actually an indentation?
293293
if (indent.column < lastIndent.column) {
294-
return 0;
294+
return nullptr;
295295
}
296296
if (indent.column == lastIndent.column &&
297297
!(indent.type == IndentMarker::SEQ &&
298298
lastIndent.type == IndentMarker::MAP)) {
299-
return 0;
299+
return nullptr;
300300
}
301301

302302
// push a start token

src/scanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Scanner {
4949
enum INDENT_TYPE { MAP, SEQ, NONE };
5050
enum STATUS { VALID, INVALID, UNKNOWN };
5151
IndentMarker(int column_, INDENT_TYPE type_)
52-
: column(column_), type(type_), status(VALID), pStartToken(0) {}
52+
: column(column_), type(type_), status(VALID), pStartToken(nullptr) {}
5353

5454
int column;
5555
INDENT_TYPE type;

src/simplekey.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace YAML {
55
struct Mark;
66

77
Scanner::SimpleKey::SimpleKey(const Mark& mark_, std::size_t flowLevel_)
8-
: mark(mark_), flowLevel(flowLevel_), pIndent(0), pMapStart(0), pKey(0) {}
8+
: mark(mark_), flowLevel(flowLevel_), pIndent(nullptr), pMapStart(nullptr), pKey(nullptr) {}
99

1010
void Scanner::SimpleKey::Validate() {
1111
// Note: pIndent will *not* be garbage here;

0 commit comments

Comments
 (0)