fix: optimization: PVS-Studio warning V832

It's better to use '= default;' syntax instead of empty constructor and destructor body.
Using '= default;' can help the compiler generate more optimal code.

Reported by: PVS-Studio

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-03 17:44:10 +03:00
committed by MihailRis
parent c858913a2f
commit aecd0f5db9
32 changed files with 38 additions and 58 deletions
+1 -2
View File
@@ -19,8 +19,7 @@ Atlas::Atlas(
}
}
Atlas::~Atlas() {
}
Atlas::~Atlas() = default;
void Atlas::prepare() {
texture = Texture::from(image.get());
+1 -1
View File
@@ -47,7 +47,7 @@ class AtlasBuilder {
std::vector<atlasentry> entries;
std::set<std::string> names;
public:
AtlasBuilder() {}
AtlasBuilder() = default;
void add(const std::string& name, std::unique_ptr<ImageData> image);
bool has(const std::string& name) const;
const std::set<std::string>& getNames() { return names; };
+1 -2
View File
@@ -12,8 +12,7 @@ Font::Font(std::vector<std::unique_ptr<Texture>> pages, int lineHeight, int yoff
: lineHeight(lineHeight), yoffset(yoffset), pages(std::move(pages)) {
}
Font::~Font(){
}
Font::~Font() = default;
int Font::getYOffset() const {
return yoffset;
+1 -2
View File
@@ -41,8 +41,7 @@ ImageData::ImageData(ImageFormat format, uint width, uint height, const ubyte* d
std::memcpy(this->data.get(), data, width * height * pixsize);
}
ImageData::~ImageData() {
}
ImageData::~ImageData() = default;
void ImageData::flipX() {
switch (format) {
+1 -2
View File
@@ -18,8 +18,7 @@ PostProcessing::PostProcessing() {
quadMesh = std::make_unique<Mesh>(vertices, 6, attrs);
}
PostProcessing::~PostProcessing() {
}
PostProcessing::~PostProcessing() = default;
void PostProcessing::use(DrawContext& context) {
const auto& vp = context.getViewport();
+1 -1
View File
@@ -32,7 +32,7 @@ uint Shader::getUniformLocation(const std::string& name) {
auto found = uniformLocations.find(name);
if (found == uniformLocations.end()) {
uint location = glGetUniformLocation(id, name.c_str());
uniformLocations.emplace(name, location);
uniformLocations.try_emplace(name, location);
return location;
}
return found->second;
+1 -1
View File
@@ -22,7 +22,7 @@ struct Frame {
class TextureAnimation {
public:
TextureAnimation(Texture* srcTex, Texture* dstTex) : srcTexture(srcTex), dstTexture(dstTex) {};
~TextureAnimation() {};
~TextureAnimation() = default;
void addFrame(const Frame& frame) { frames.emplace_back(frame); };