Remove unnecessary friend class
declarations of CowData
.
#100650
+18
−30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a small cleanup I did while doing sanity checks for #100619.
The
friend class
declarations are unnecessary. They should be removed because they increase coupling. It additionally makes no sense to havefriend
classes becauseCowData
should be designed such that it can be used from any class, and not just some known specific classes.There are only a few affected spots:
_ref()
calls can be replaced withoperator=(const CowData &)
calls. The resulting call is the exact same:godot/core/templates/cowdata.h
Line 172 in 89001f9
Forward declarations can also be removed. Two headers were passively using them before (
visual_shader
andvector
). I moved the forward declarations to the appropriate spots.Finally, I also made
_get_alloc_size
and_get_alloc_size_checked
static. This is a small change that doesn't warrant a separate PR. It does not make sense to have the functions be member functions, because it is relied upon that allocation sizes are consistent across different instances ofCowData
. It has to be deterministic by class alone.