From f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 15 Jun 2018 12:46:15 +0200 Subject: =?UTF-8?q?Run=20clang-tidy=E2=80=99s=20modernize-use-nullptr=20pa?= =?UTF-8?q?ss.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces all NULL or 0 with nullptr when assigned to or returned as a pointer. --- src/document-subset.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/document-subset.cpp') diff --git a/src/document-subset.cpp b/src/document-subset.cpp index f5e60db31..b16c1879f 100644 --- a/src/document-subset.cpp +++ b/src/document-subset.cpp @@ -31,7 +31,7 @@ struct DocumentSubset::Relations : public GC::Managed, sigc::connection release_connection; sigc::connection position_changed_connection; - Record() : parent(NULL) {} + Record() : parent(nullptr) {} unsigned childIndex(SPObject *obj) { Siblings::iterator found; @@ -126,7 +126,7 @@ struct DocumentSubset::Relations : public GC::Managed, sigc::signal added_signal; sigc::signal removed_signal; - Relations() { records[NULL]; } + Relations() { records[nullptr]; } ~Relations() override { for ( Map::iterator iter=records.begin() @@ -146,7 +146,7 @@ struct DocumentSubset::Relations : public GC::Managed, if ( found != records.end() ) { return &(*found).second; } else { - return NULL; + return nullptr; } } @@ -177,8 +177,8 @@ private: void _doRemove(SPObject *obj) { Record &record=records[obj]; - if ( record.parent == NULL ) { - Record &root = records[NULL]; + if ( record.parent == nullptr ) { + Record &root = records[nullptr]; for ( Siblings::iterator it = root.children.begin(); it != root.children.end(); ++it ) { if ( *it == obj ) { root.children.erase( it ); @@ -220,13 +220,13 @@ DocumentSubset::DocumentSubset() } void DocumentSubset::Relations::addOne(SPObject *obj) { - g_return_if_fail( obj != NULL ); - g_return_if_fail( get(obj) == NULL ); + g_return_if_fail( obj != nullptr ); + g_return_if_fail( get(obj) == nullptr ); Record &record=_doAdd(obj); /* find the nearest ancestor in the subset */ - Record *parent_record=NULL; + Record *parent_record=nullptr; for ( SPObject::ParentIterator parent_iter=obj->parent ; !parent_record && parent_iter ; ++parent_iter ) { @@ -236,8 +236,8 @@ void DocumentSubset::Relations::addOne(SPObject *obj) { } } if (!parent_record) { - parent_record = get(NULL); - g_assert( parent_record != NULL ); + parent_record = get(nullptr); + g_assert( parent_record != nullptr ); } Siblings &children=record.children; @@ -251,7 +251,7 @@ void DocumentSubset::Relations::addOne(SPObject *obj) { ; iter != children.end() ; ++iter ) { Record *child_record=get(*iter); - g_assert( child_record != NULL ); + g_assert( child_record != nullptr ); child_record->parent = obj; } @@ -263,13 +263,13 @@ void DocumentSubset::Relations::addOne(SPObject *obj) { } void DocumentSubset::Relations::remove(SPObject *obj, bool subtree) { - g_return_if_fail( obj != NULL ); + g_return_if_fail( obj != nullptr ); Record *record=get(obj); - g_return_if_fail( record != NULL ); + g_return_if_fail( record != nullptr ); Record *parent_record=get(record->parent); - g_assert( parent_record != NULL ); + g_assert( parent_record != nullptr ); unsigned index=parent_record->removeChild(obj); @@ -286,7 +286,7 @@ void DocumentSubset::Relations::remove(SPObject *obj, bool subtree) { ; iter != children.end() ; ++iter) { Record *child_record=get(*iter); - g_assert( child_record != NULL ); + g_assert( child_record != nullptr ); child_record->parent = record->parent; } @@ -298,7 +298,7 @@ void DocumentSubset::Relations::remove(SPObject *obj, bool subtree) { } void DocumentSubset::Relations::clear() { - Record &root=records[NULL]; + Record &root=records[nullptr]; while (!root.children.empty()) { _doRemoveSubtree(root.children.front()); @@ -311,7 +311,7 @@ void DocumentSubset::Relations::reorder(SPObject *obj) { SPObject::ParentIterator parent=obj; /* find nearest ancestor in the subset */ - Record *parent_record=NULL; + Record *parent_record=nullptr; while (!parent_record) { parent_record = get(++parent); } @@ -356,7 +356,7 @@ bool DocumentSubset::includes(SPObject *obj) const { SPObject *DocumentSubset::parentOf(SPObject *obj) const { Relations::Record *record=_relations->get(obj); - return ( record ? record->parent : NULL ); + return ( record ? record->parent : nullptr ); } unsigned DocumentSubset::childCount(SPObject *obj) const { @@ -372,7 +372,7 @@ unsigned DocumentSubset::indexOf(SPObject *obj) const { SPObject *DocumentSubset::nthChildOf(SPObject *obj, unsigned n) const { Relations::Record *record=_relations->get(obj); - return ( record ? record->children[n] : NULL ); + return ( record ? record->children[n] : nullptr ); } sigc::connection DocumentSubset::connectChanged(sigc::slot slot) const { -- cgit v1.2.3