summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Admiraal <madmiraal@users.noreply.github.com>2020-09-04 09:18:19 +0100
committerMarcel Admiraal <madmiraal@users.noreply.github.com>2020-09-04 09:18:19 +0100
commitce263c4ff680f28594ffc1886a4f418c50c41ef7 (patch)
tree08a46d913d177d335fc639931994845fa97e7fcc
parent27763b67bb63139319bf611590c40e48663e72d6 (diff)
Ensure assignment operators return by reference to avoid unnecessary copies.
-rw-r--r--core/math/audio_frame.h2
-rw-r--r--core/math/quat.h2
-rw-r--r--core/ustring.h6
-rw-r--r--editor/editor_audio_buses.h2
-rw-r--r--scene/3d/soft_body_3d.cpp2
-rw-r--r--scene/3d/soft_body_3d.h2
-rw-r--r--servers/physics_server_2d.h2
-rw-r--r--servers/physics_server_3d.h2
8 files changed, 10 insertions, 10 deletions
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
index 91f533eafb..43d4a63cd3 100644
--- a/core/math/audio_frame.h
+++ b/core/math/audio_frame.h
@@ -121,7 +121,7 @@ struct AudioFrame {
r = p_frame.r;
}
- _ALWAYS_INLINE_ AudioFrame operator=(const AudioFrame &p_frame) {
+ _ALWAYS_INLINE_ AudioFrame &operator=(const AudioFrame &p_frame) {
l = p_frame.l;
r = p_frame.r;
return *this;
diff --git a/core/math/quat.h b/core/math/quat.h
index 64d0f00912..8619ea3c5c 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -130,7 +130,7 @@ public:
w(q.w) {
}
- Quat operator=(const Quat &q) {
+ Quat &operator=(const Quat &q) {
x = q.x;
y = q.y;
z = q.z;
diff --git a/core/ustring.h b/core/ustring.h
index 65eeae6643..1f8a5d7e7d 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -103,7 +103,7 @@ public:
_FORCE_INLINE_ Char16String() {}
_FORCE_INLINE_ Char16String(const Char16String &p_str) { _cowdata._ref(p_str._cowdata); }
- _FORCE_INLINE_ Char16String operator=(const Char16String &p_str) {
+ _FORCE_INLINE_ Char16String &operator=(const Char16String &p_str) {
_cowdata._ref(p_str._cowdata);
return *this;
}
@@ -147,7 +147,7 @@ public:
_FORCE_INLINE_ CharString() {}
_FORCE_INLINE_ CharString(const CharString &p_str) { _cowdata._ref(p_str._cowdata); }
- _FORCE_INLINE_ CharString operator=(const CharString &p_str) {
+ _FORCE_INLINE_ CharString &operator=(const CharString &p_str) {
_cowdata._ref(p_str._cowdata);
return *this;
}
@@ -435,7 +435,7 @@ public:
_FORCE_INLINE_ String() {}
_FORCE_INLINE_ String(const String &p_str) { _cowdata._ref(p_str._cowdata); }
- String operator=(const String &p_str) {
+ String &operator=(const String &p_str) {
_cowdata._ref(p_str._cowdata);
return *this;
}
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 87c060d1f5..b6cf1183b5 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -230,7 +230,7 @@ private:
render_db_value = n.render_db_value;
}
- _FORCE_INLINE_ AudioNotch operator=(const EditorAudioMeterNotches::AudioNotch &n) {
+ _FORCE_INLINE_ AudioNotch &operator=(const EditorAudioMeterNotches::AudioNotch &n) {
relative_position = n.relative_position;
db_value = n.db_value;
render_db_value = n.render_db_value;
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index a267c57f5e..d3d7cdc1ce 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -106,7 +106,7 @@ SoftBody3D::PinnedPoint::PinnedPoint(const PinnedPoint &obj_tocopy) {
offset = obj_tocopy.offset;
}
-SoftBody3D::PinnedPoint SoftBody3D::PinnedPoint::operator=(const PinnedPoint &obj) {
+SoftBody3D::PinnedPoint &SoftBody3D::PinnedPoint::operator=(const PinnedPoint &obj) {
point_index = obj.point_index;
spatial_attachment_path = obj.spatial_attachment_path;
spatial_attachment = obj.spatial_attachment;
diff --git a/scene/3d/soft_body_3d.h b/scene/3d/soft_body_3d.h
index 85cfb81637..c59a0b3aa3 100644
--- a/scene/3d/soft_body_3d.h
+++ b/scene/3d/soft_body_3d.h
@@ -74,7 +74,7 @@ public:
PinnedPoint();
PinnedPoint(const PinnedPoint &obj_tocopy);
- PinnedPoint operator=(const PinnedPoint &obj);
+ PinnedPoint &operator=(const PinnedPoint &obj);
};
private:
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index e631046524..f609adccf9 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -644,7 +644,7 @@ class PhysicsServer2DManager {
name(p_ci.name),
create_callback(p_ci.create_callback) {}
- ClassInfo operator=(const ClassInfo &p_ci) {
+ ClassInfo &operator=(const ClassInfo &p_ci) {
name = p_ci.name;
create_callback = p_ci.create_callback;
return *this;
diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h
index dcb183aea4..b779942460 100644
--- a/servers/physics_server_3d.h
+++ b/servers/physics_server_3d.h
@@ -785,7 +785,7 @@ class PhysicsServer3DManager {
name(p_ci.name),
create_callback(p_ci.create_callback) {}
- ClassInfo operator=(const ClassInfo &p_ci) {
+ ClassInfo &operator=(const ClassInfo &p_ci) {
name = p_ci.name;
create_callback = p_ci.create_callback;
return *this;