memory-related refactor

This commit is contained in:
MihailRis
2024-05-25 09:26:21 +03:00
parent d437b67580
commit 43903bb378
9 changed files with 41 additions and 36 deletions
+2 -2
View File
@@ -98,7 +98,7 @@ glshader compile_shader(GLenum type, const GLchar* source, const std::string& fi
return glshader(new GLuint(shader), shader_deleter);
}
Shader* Shader::create(
std::unique_ptr<Shader> Shader::create(
const std::string& vertexFile,
const std::string& fragmentFile,
const std::string& vertexCode,
@@ -125,5 +125,5 @@ Shader* Shader::create(
"shader program linking failed:\n"+std::string(infoLog)
);
}
return new Shader(id);
return std::make_unique<Shader>(id);
}
+2 -1
View File
@@ -4,6 +4,7 @@
#include "../../typedefs.hpp"
#include <string>
#include <memory>
#include <unordered_map>
#include <glm/glm.hpp>
@@ -36,7 +37,7 @@ public:
/// @param vertexSource vertex shader source code
/// @param fragmentSource fragment shader source code
/// @return linked shader program containing vertex and fragment shaders
static Shader* create(
static std::unique_ptr<Shader> create(
const std::string& vertexFile,
const std::string& fragmentFile,
const std::string& vertexSource,