diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-01-28 16:50:13 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-01-28 17:10:44 +0300 |
commit | 40a9b5ebc77953a3f0b47def39438beed681aac0 (patch) | |
tree | 7c59d584e43ea837a40e064a73859909f08ca84b /source/blender/depsgraph/intern/node | |
parent | 01a348274218103ecdbaddc699a97e86f0c4ce18 (diff) |
Cleanup: changed NULL to nullptr in depsgraph C++ code
No functional changes.
Diffstat (limited to 'source/blender/depsgraph/intern/node')
7 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index acfc8d19bc7..3878362d936 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -191,11 +191,11 @@ struct Node { virtual OperationNode *get_entry_operation() { - return NULL; + return nullptr; } virtual OperationNode *get_exit_operation() { - return NULL; + return nullptr; } virtual NodeClass get_class() const; diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc index 830c53cfc76..334f55c0942 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.cc +++ b/source/blender/depsgraph/intern/node/deg_node_component.cc @@ -104,7 +104,7 @@ static void comp_node_hash_value_free(void *value_v) } ComponentNode::ComponentNode() - : entry_operation(NULL), exit_operation(NULL), affects_directly_visible(false) + : entry_operation(nullptr), exit_operation(nullptr), affects_directly_visible(false) { operations_map = BLI_ghash_new(comp_node_hash_key, comp_node_hash_key_cmp, "Depsgraph id hash"); } @@ -120,7 +120,7 @@ void ComponentNode::init(const ID * /*id*/, const char * /*subdata*/) ComponentNode::~ComponentNode() { clear_operations(); - if (operations_map != NULL) { + if (operations_map != nullptr) { BLI_ghash_free(operations_map, comp_node_hash_key_free, comp_node_hash_value_free); } } @@ -135,8 +135,8 @@ string ComponentNode::identifier() const OperationNode *ComponentNode::find_operation(OperationIDKey key) const { - OperationNode *node = NULL; - if (operations_map != NULL) { + OperationNode *node = nullptr; + if (operations_map != nullptr) { node = (OperationNode *)BLI_ghash_lookup(operations_map, &key); } else { @@ -162,13 +162,13 @@ OperationNode *ComponentNode::find_operation(OperationCode opcode, OperationNode *ComponentNode::get_operation(OperationIDKey key) const { OperationNode *node = find_operation(key); - if (node == NULL) { + if (node == nullptr) { fprintf(stderr, "%s: find_operation(%s) failed\n", this->identifier().c_str(), key.identifier().c_str()); BLI_assert(!"Request for non-existing operation, should not happen"); - return NULL; + return nullptr; } return node; } @@ -183,7 +183,7 @@ OperationNode *ComponentNode::get_operation(OperationCode opcode, bool ComponentNode::has_operation(OperationIDKey key) const { - return find_operation(key) != NULL; + return find_operation(key) != nullptr; } bool ComponentNode::has_operation(OperationCode opcode, const char *name, int name_tag) const @@ -229,19 +229,19 @@ OperationNode *ComponentNode::add_operation(const DepsEvalOperationCb &op, void ComponentNode::set_entry_operation(OperationNode *op_node) { - BLI_assert(entry_operation == NULL); + BLI_assert(entry_operation == nullptr); entry_operation = op_node; } void ComponentNode::set_exit_operation(OperationNode *op_node) { - BLI_assert(exit_operation == NULL); + BLI_assert(exit_operation == nullptr); exit_operation = op_node; } void ComponentNode::clear_operations() { - if (operations_map != NULL) { + if (operations_map != nullptr) { BLI_ghash_clear(operations_map, comp_node_hash_key_free, comp_node_hash_value_free); } for (OperationNode *op_node : operations) { @@ -253,14 +253,14 @@ void ComponentNode::clear_operations() void ComponentNode::tag_update(Depsgraph *graph, eUpdateSource source) { OperationNode *entry_op = get_entry_operation(); - if (entry_op != NULL && entry_op->flag & DEPSOP_FLAG_NEEDS_UPDATE) { + if (entry_op != nullptr && entry_op->flag & DEPSOP_FLAG_NEEDS_UPDATE) { return; } for (OperationNode *op_node : operations) { op_node->tag_update(graph, source); } // It is possible that tag happens before finalization. - if (operations_map != NULL) { + if (operations_map != nullptr) { GHASH_FOREACH_BEGIN (OperationNode *, op_node, operations_map) { op_node->tag_update(graph, source); } @@ -273,8 +273,8 @@ OperationNode *ComponentNode::get_entry_operation() if (entry_operation) { return entry_operation; } - else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) { - OperationNode *op_node = NULL; + else if (operations_map != nullptr && BLI_ghash_len(operations_map) == 1) { + OperationNode *op_node = nullptr; /* TODO(sergey): This is somewhat slow. */ GHASH_FOREACH_BEGIN (OperationNode *, tmp, operations_map) { op_node = tmp; @@ -287,7 +287,7 @@ OperationNode *ComponentNode::get_entry_operation() else if (operations.size() == 1) { return operations[0]; } - return NULL; + return nullptr; } OperationNode *ComponentNode::get_exit_operation() @@ -295,8 +295,8 @@ OperationNode *ComponentNode::get_exit_operation() if (exit_operation) { return exit_operation; } - else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) { - OperationNode *op_node = NULL; + else if (operations_map != nullptr && BLI_ghash_len(operations_map) == 1) { + OperationNode *op_node = nullptr; /* TODO(sergey): This is somewhat slow. */ GHASH_FOREACH_BEGIN (OperationNode *, tmp, operations_map) { op_node = tmp; @@ -309,7 +309,7 @@ OperationNode *ComponentNode::get_exit_operation() else if (operations.size() == 1) { return operations[0]; } - return NULL; + return nullptr; } void ComponentNode::finalize_build(Depsgraph * /*graph*/) @@ -319,8 +319,8 @@ void ComponentNode::finalize_build(Depsgraph * /*graph*/) operations.push_back(op_node); } GHASH_FOREACH_END(); - BLI_ghash_free(operations_map, comp_node_hash_key_free, NULL); - operations_map = NULL; + BLI_ghash_free(operations_map, comp_node_hash_key_free, nullptr); + operations_map = nullptr; } /* Bone Component ========================================= */ diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h index 53fbc6e617c..c25f0bbd7aa 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.h +++ b/source/blender/depsgraph/intern/node/deg_node_component.h @@ -65,7 +65,7 @@ struct ComponentNode : public Node { virtual string identifier() const override; /* Find an existing operation, if requested operation does not exist - * NULL will be returned. */ + * nullptr will be returned. */ OperationNode *find_operation(OperationIDKey key) const; OperationNode *find_operation(OperationCode opcode, const char *name, int name_tag) const; diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.cc b/source/blender/depsgraph/intern/node/deg_node_factory.cc index 4a11ed2a4fb..9dfd018b4fd 100644 --- a/source/blender/depsgraph/intern/node/deg_node_factory.cc +++ b/source/blender/depsgraph/intern/node/deg_node_factory.cc @@ -26,11 +26,11 @@ namespace DEG { /* Global type registry */ -static DepsNodeFactory *node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {NULL}; +static DepsNodeFactory *node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {nullptr}; void register_node_typeinfo(DepsNodeFactory *factory) { - BLI_assert(factory != NULL); + BLI_assert(factory != nullptr); const int type_as_int = static_cast<int>(factory->type()); node_typeinfo_registry[type_as_int] = factory; } diff --git a/source/blender/depsgraph/intern/node/deg_node_id.cc b/source/blender/depsgraph/intern/node/deg_node_id.cc index e14513a1aa2..853198109a2 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.cc +++ b/source/blender/depsgraph/intern/node/deg_node_id.cc @@ -101,7 +101,7 @@ static void id_deps_node_hash_value_free(void *value_v) /* Initialize 'id' node - from pointer data given. */ void IDNode::init(const ID *id, const char *UNUSED(subdata)) { - BLI_assert(id != NULL); + BLI_assert(id != nullptr); /* Store ID-pointer. */ id_orig = (ID *)id; eval_flags = 0; @@ -126,7 +126,7 @@ void IDNode::init_copy_on_write(ID *id_cow_hint) /* Create pointer as early as possible, so we can use it for function * bindings. Rest of data we'll be copying to the new datablock when * it is actually needed. */ - if (id_cow_hint != NULL) { + if (id_cow_hint != nullptr) { // BLI_assert(deg_copy_on_write_is_needed(id_orig)); if (deg_copy_on_write_is_needed(id_orig)) { id_cow = id_cow_hint; @@ -154,22 +154,22 @@ IDNode::~IDNode() void IDNode::destroy() { - if (id_orig == NULL) { + if (id_orig == nullptr) { return; } BLI_ghash_free(components, id_deps_node_hash_key_free, id_deps_node_hash_value_free); /* Free memory used by this CoW ID. */ - if (id_cow != id_orig && id_cow != NULL) { + if (id_cow != id_orig && id_cow != nullptr) { deg_free_copy_on_write_datablock(id_cow); MEM_freeN(id_cow); - id_cow = NULL; + id_cow = nullptr; DEG_COW_PRINT("Destroy CoW for %s: id_orig=%p id_cow=%p\n", id_orig->name, id_orig, id_cow); } /* Tag that the node is freed. */ - id_orig = NULL; + id_orig = nullptr; } string IDNode::identifier() const diff --git a/source/blender/depsgraph/intern/node/deg_node_id.h b/source/blender/depsgraph/intern/node/deg_node_id.h index 35184253f5c..886c25b5a4e 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.h +++ b/source/blender/depsgraph/intern/node/deg_node_id.h @@ -57,7 +57,7 @@ struct IDNode : public Node { }; virtual void init(const ID *id, const char *subdata) override; - void init_copy_on_write(ID *id_cow_hint = NULL); + void init_copy_on_write(ID *id_cow_hint = nullptr); ~IDNode(); void destroy(); diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc b/source/blender/depsgraph/intern/node/deg_node_operation.cc index 09a761d282f..e313b5ccee7 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.cc +++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc @@ -241,13 +241,13 @@ void OperationNode::tag_update(Depsgraph *graph, eUpdateSource source) void OperationNode::set_as_entry() { - BLI_assert(owner != NULL); + BLI_assert(owner != nullptr); owner->set_entry_operation(this); } void OperationNode::set_as_exit() { - BLI_assert(owner != NULL); + BLI_assert(owner != nullptr); owner->set_exit_operation(this); } |