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:
committed by
MihailRis
parent
c858913a2f
commit
aecd0f5db9
@@ -19,8 +19,7 @@ Atlas::Atlas(
|
||||
}
|
||||
}
|
||||
|
||||
Atlas::~Atlas() {
|
||||
}
|
||||
Atlas::~Atlas() = default;
|
||||
|
||||
void Atlas::prepare() {
|
||||
texture = Texture::from(image.get());
|
||||
|
||||
@@ -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; };
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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); };
|
||||
|
||||
|
||||
@@ -64,8 +64,7 @@ ModelBatch::ModelBatch(size_t capacity, Assets* assets, Chunks* chunks)
|
||||
blank = Texture::from(&image);
|
||||
}
|
||||
|
||||
ModelBatch::~ModelBatch() {
|
||||
}
|
||||
ModelBatch::~ModelBatch() = default;
|
||||
|
||||
void ModelBatch::draw(const model::Mesh& mesh, const glm::mat4& matrix,
|
||||
const glm::mat3& rotation, glm::vec3 tint,
|
||||
|
||||
@@ -55,8 +55,7 @@ Skybox::Skybox(uint size, Shader* shader)
|
||||
});
|
||||
}
|
||||
|
||||
Skybox::~Skybox() {
|
||||
}
|
||||
Skybox::~Skybox() = default;
|
||||
|
||||
void Skybox::drawBackground(Camera* camera, Assets* assets, int width, int height) {
|
||||
auto backShader = assets->get<Shader>("background");
|
||||
|
||||
@@ -75,8 +75,7 @@ WorldRenderer::WorldRenderer(Engine* engine, LevelFrontend* frontend, Player* pl
|
||||
);
|
||||
}
|
||||
|
||||
WorldRenderer::~WorldRenderer() {
|
||||
}
|
||||
WorldRenderer::~WorldRenderer() = default;
|
||||
|
||||
bool WorldRenderer::drawChunk(
|
||||
size_t index,
|
||||
|
||||
@@ -44,8 +44,7 @@ GUI::GUI() {
|
||||
container->add(tooltip);
|
||||
}
|
||||
|
||||
GUI::~GUI() {
|
||||
}
|
||||
GUI::~GUI() = default;
|
||||
|
||||
std::shared_ptr<Menu> GUI::getMenu() {
|
||||
return menu;
|
||||
|
||||
Reference in New Issue
Block a user