summaryrefslogtreecommitdiff
path: root/core/reference.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /core/reference.cpp
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'core/reference.cpp')
-rw-r--r--core/reference.cpp11
1 files changed, 0 insertions, 11 deletions
diff --git a/core/reference.cpp b/core/reference.cpp
index 57b72dcaad..cc8a9854fb 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -33,22 +33,18 @@
#include "core/script_language.h"
bool Reference::init_ref() {
-
if (reference()) {
-
if (!is_referenced() && refcount_init.unref()) {
unreference(); // first referencing is already 1, so compensate for the ref above
}
return true;
} else {
-
return false;
}
}
void Reference::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("init_ref"), &Reference::init_ref);
ClassDB::bind_method(D_METHOD("reference"), &Reference::reference);
ClassDB::bind_method(D_METHOD("unreference"), &Reference::unreference);
@@ -59,7 +55,6 @@ int Reference::reference_get_count() const {
}
bool Reference::reference() {
-
uint32_t rc_val = refcount.refval();
bool success = rc_val != 0;
@@ -80,7 +75,6 @@ bool Reference::reference() {
}
bool Reference::unreference() {
-
uint32_t rc_val = refcount.unrefval();
bool die = rc_val == 0;
@@ -104,13 +98,11 @@ bool Reference::unreference() {
Reference::Reference() :
Object(true) {
-
refcount.init();
refcount_init.init();
}
Variant WeakRef::get_ref() const {
-
if (ref.is_null())
return Variant();
@@ -119,7 +111,6 @@ Variant WeakRef::get_ref() const {
return Variant();
Reference *r = cast_to<Reference>(obj);
if (r) {
-
return REF(r);
}
@@ -131,11 +122,9 @@ void WeakRef::set_obj(Object *p_object) {
}
void WeakRef::set_ref(const REF &p_ref) {
-
ref = p_ref.is_valid() ? p_ref->get_instance_id() : ObjectID();
}
void WeakRef::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("get_ref"), &WeakRef::get_ref);
}