[Bf-blender-cvs] [6ad32098af1] functions: do not use this-> for prefixed member variables
Jacques Lucke
noreply at git.blender.org
Sun Feb 10 20:26:44 CET 2019
Commit: 6ad32098af110ad833e0d0f03867c7a14440c55c
Author: Jacques Lucke
Date: Fri Feb 8 13:58:20 2019 +0100
Branches: functions
https://developer.blender.org/rB6ad32098af110ad833e0d0f03867c7a14440c55c
do not use this-> for prefixed member variables
===================================================================
M source/blender/blenlib/BLI_composition.hpp
M source/blender/blenlib/BLI_refcount.hpp
M source/blender/blenlib/BLI_shared.hpp
M source/blender/blenlib/BLI_small_map.hpp
M source/blender/blenlib/BLI_small_set.hpp
M source/blender/blenlib/BLI_small_vector.hpp
M source/blender/functions/core/core.hpp
M source/blender/functions/core/cpu.hpp
M source/blender/functions/core/data_flow_graph.cpp
M source/blender/functions/core/data_flow_graph.hpp
M source/blender/functions/core/dot_export.cpp
M source/blender/functions/core/graph_to_function.cpp
M tests/gtests/blenlib/BLI_shared_test.cc
===================================================================
diff --git a/source/blender/blenlib/BLI_composition.hpp b/source/blender/blenlib/BLI_composition.hpp
index 571d2921e0b..26a58815ca4 100644
--- a/source/blender/blenlib/BLI_composition.hpp
+++ b/source/blender/blenlib/BLI_composition.hpp
@@ -22,15 +22,15 @@ namespace BLI {
template<typename T>
void add(T *value)
{
- this->m_elements.add(this->get_key<T>(), Entry(value));
+ m_elements.add(this->get_key<T>(), Entry(value));
}
template<typename T>
inline T *get() const
{
uint64_t key = this->get_key<T>();
- if (this->m_elements.contains(key)) {
- return (T *)this->m_elements.lookup(key).value;
+ if (m_elements.contains(key)) {
+ return (T *)m_elements.lookup(key).value;
}
else {
return nullptr;
@@ -39,7 +39,7 @@ namespace BLI {
~Composition()
{
- for (const Entry &entry : this->m_elements.values()) {
+ for (const Entry &entry : m_elements.values()) {
entry.free(entry.value);
}
}
diff --git a/source/blender/blenlib/BLI_refcount.hpp b/source/blender/blenlib/BLI_refcount.hpp
index 83e0439f034..379a739b93c 100644
--- a/source/blender/blenlib/BLI_refcount.hpp
+++ b/source/blender/blenlib/BLI_refcount.hpp
@@ -29,13 +29,13 @@ namespace BLI {
RefCount(const RefCount &other)
{
- this->m_object = other.m_object;
+ m_object = other.m_object;
this->incref();
}
RefCount(const RefCount &&other)
{
- this->m_object = other.m_object;
+ m_object = other.m_object;
this->incref();
}
@@ -46,12 +46,12 @@ namespace BLI {
RefCount &operator=(const RefCount &other)
{
- if (this->m_object == other->m_object) {
+ if (m_object == other->m_object) {
return *this;
}
this->decref();
- this->m_object = other.m_object;
+ m_object = other.m_object;
this->incref();
return *this;
}
@@ -59,34 +59,34 @@ namespace BLI {
RefCount &operator=(const RefCount &&other)
{
this->decref();
- this->m_object = other.m_object;
+ m_object = other.m_object;
this->incref();
return *this;
}
void incref()
{
- std::atomic_fetch_add(&this->m_object->m_refcount, 1);
+ std::atomic_fetch_add(&m_object->m_refcount, 1);
}
void decref()
{
- int previous_value = std::atomic_fetch_sub(&this->m_object->m_refcount, 1);
+ int previous_value = std::atomic_fetch_sub(&m_object->m_refcount, 1);
if (previous_value == 1) {
- delete this->m_object->m_value;
- delete this->m_object;
- this->m_object = nullptr;
+ delete m_object->m_value;
+ delete m_object;
+ m_object = nullptr;
}
}
int refcount() const
{
- return this->m_object->m_refcount;
+ return m_object->m_refcount;
}
T *operator->() const
{
- return this->m_object->m_value;
+ return m_object->m_value;
}
};
diff --git a/source/blender/blenlib/BLI_shared.hpp b/source/blender/blenlib/BLI_shared.hpp
index b2b69131262..1d08922a82b 100644
--- a/source/blender/blenlib/BLI_shared.hpp
+++ b/source/blender/blenlib/BLI_shared.hpp
@@ -17,26 +17,26 @@ namespace BLI {
inline void incref()
{
- std::atomic_fetch_add(&this->m_refcount, 1);
+ std::atomic_fetch_add(&m_refcount, 1);
}
inline void decref()
{
- int previous_value = std::atomic_fetch_sub(&this->m_refcount, 1);
+ int previous_value = std::atomic_fetch_sub(&m_refcount, 1);
if (previous_value == 1) {
- delete this->m_object;
+ delete m_object;
delete this;
}
}
int refcount() const
{
- return this->m_refcount;
+ return m_refcount;
}
T *ptr() const
{
- return this->m_object;
+ return m_object;
}
};
@@ -51,12 +51,12 @@ namespace BLI {
inline void incref()
{
- this->m_object->incref();
+ m_object->incref();
}
inline void decref()
{
- this->m_object->decref();
+ m_object->decref();
}
public:
@@ -75,32 +75,32 @@ namespace BLI {
Shared(const Shared &other)
{
- this->m_object = other.m_object;
+ m_object = other.m_object;
this->incref();
}
Shared(Shared &&other)
{
- this->m_object = other.m_object;
+ m_object = other.m_object;
other.m_object = nullptr;
}
~Shared()
{
/* Can be nullptr when previously moved. */
- if (this->m_object != nullptr) {
+ if (m_object != nullptr) {
this->decref();
}
}
Shared &operator=(const Shared &other)
{
- if (this->m_object == other->m_object) {
+ if (m_object == other->m_object) {
return *this;
}
this->decref();
- this->m_object = other.m_object;
+ m_object = other.m_object;
this->incref();
return *this;
}
@@ -108,19 +108,19 @@ namespace BLI {
Shared &operator=(Shared &&other)
{
this->decref();
- this->m_object = other.m_object;
+ m_object = other.m_object;
other.m_object = nullptr;
return *this;
}
T *operator->() const
{
- return this->m_object->ptr();
+ return m_object->ptr();
}
RefCounted<T> *refcounter() const
{
- return this->m_object;
+ return m_object;
}
friend bool operator==(const Shared &a, const Shared &b)
diff --git a/source/blender/blenlib/BLI_small_map.hpp b/source/blender/blenlib/BLI_small_map.hpp
index c512320bda8..19335ac7fe4 100644
--- a/source/blender/blenlib/BLI_small_map.hpp
+++ b/source/blender/blenlib/BLI_small_map.hpp
@@ -25,18 +25,18 @@ namespace BLI {
void add(K key, V value)
{
- for (Entry &entry : this->m_entries) {
+ for (Entry &entry : m_entries) {
if (entry.key == key) {
entry.value = value;
return;
}
}
- this->m_entries.append(Entry(key, value));
+ m_entries.append(Entry(key, value));
}
bool contains(K key) const
{
- for (Entry entry : this->m_entries) {
+ for (Entry entry : m_entries) {
if (entry.key == key) {
return true;
}
@@ -58,7 +58,7 @@ namespace BLI {
V *lookup_ptr(const K &key) const
{
- for (Entry &entry : this->m_entries) {
+ for (Entry &entry : m_entries) {
if (entry.key == key) {
return &entry.value;
}
@@ -68,7 +68,7 @@ namespace BLI {
uint size() const
{
- return this->m_entries.size();
+ return m_entries.size();
}
ValueIterator values() const
@@ -89,17 +89,17 @@ namespace BLI {
ValueIterator begin() const
{
- return ValueIterator(this->m_map, 0);
+ return ValueIterator(m_map, 0);
}
ValueIterator end() const
{
- return ValueIterator(this->m_map, this->m_map.size());
+ return ValueIterator(m_map, m_map.size());
}
ValueIterator &operator++()
{
- this->m_index++;
+ m_index++;
return *this;
}
@@ -112,12 +112,12 @@ namespace BLI {
bool operator!=(const ValueIterator &iterator) const
{
- return this->m_index != iterator.m_index;
+ return m_index != iterator.m_index;
}
V operator*() const
{
- return this->m_map.m_entries[this->m_index].value;
+ return m_map.m_entries[m_index].value;
}
};
};
diff --git a/source/blender/blenlib/BLI_small_set.hpp b/source/blender/blenlib/BLI_small_set.hpp
index af024f9fcd5..1f6e7f680db 100644
--- a/source/blender/blenlib/BLI_small_set.hpp
+++ b/source/blender/blenlib/BLI_small_set.hpp
@@ -29,13 +29,13 @@ namespace BLI {
void add(T value)
{
if (!this->contains(value)) {
- this->m_entries.append(value);
+ m_entries.append(value);
}
}
bool contains(T value) const
{
- for (T entry : this->m_entries) {
+ for (T entry : m_entries) {
if (entry == value) {
return true;
}
@@ -45,13 +45,13 @@ namespace BLI {
uint size() const
{
- return this->m_entries.size();
+ return m_entries.size();
}
T any() const
{
BLI_assert(this->size() > 0);
- return this->m_entries[0];
+ return m_entries[0];
}
@@ -59,22 +59,22 @@ namespace BLI {
T *begin() const
{
- return this->m_entries.begin();
+ return m_entries.begin();
}
T *end() const
{
- return this->m_entries.end();
+ return m_entries.end();
}
const T *cbegin() const
{
- return this->m_entries.cbegin();
+ return m_entries.cbegin();
}
const T *cend() const
{
- return this->m_entries.cend();
+ return m_entries.cend();
}
};
diff --git a/source/blender/blenlib/BLI_small_vector.hpp b/source/blender/blenlib/BLI_small_vector.hpp
index c9e919a9b35..87c748b1786 100644
--- a/source/blender/blenlib/BLI_small_vector.hpp
+++ b/source/blender/blenlib/BLI_small_vector.hpp
@@ -18,9 +18,9 @@ namespace BLI {
public:
SmallVector()
{
- this->m_elements = this->small_buffer();
- this->m_capacity = N;
- this->m_size = 0;
+ m_elements = this->small_buffer();
+ m_capacity = N;
+ m_size = 0;
}
SmallVector(uint size)
@@ -85,7 +85,7 @@ namespace BLI {
{
this->ensure_space_for_one();
std::uninitialized_copy(&value, &value + 1, this->end());
- this->m_size++;
+ m_size++;
}
void append(T &&value)
@@ -95,25 +95,25 @@ namespace BLI {
std::make_move_iterator(&value),
std::make_move_iterator(&value + 1),
this->end());
- this->m_size++;
+ m_size++;
}
void fill(const T &value)
{
- for (uint i = 0; i < this->m_size; i++) {
- this->m_elements[i] = value;
+ for (uint i = 0; i < m_size; i++) {
+ m_elements[i] = value;
}
}
uint size() const
{
- return this->m_size;
+ return m_size;
}
int index(const T &value) const
{
- for (uint i = 0; i < this->m_size; i++) {
- if (this->m_elements[i] == value) {
+ for (uint i = 0; i < m_size; i++) {
+ if (m_elements[i] == value) {
return i;
}
}
@@ -123,11 +123,11 @@ namespace BLI {
T &operator[](const int index) const
{
BLI_assert(index >= 0 && index < this->size());
- return this->m_elements[index];
+ return m_elements[index];
}
T *begin() const
- { return this->m_elements; }
+ { return m_elements; }
T *end() const
{ return this->begin() + this->size(); }
@@ -139,30 +139,30 @@ namespace BLI {
private:
T *small_buffer() const
{
- return (T *)this->m_small_buffer;
+ return (T *)m_small_buffer;
}
bool is_small() const
{
- return this->m_elements == this->small_buffer();
+ return m_elements
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list