mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 03:59:19 +02:00
refactor(sonar): construct elements in place with emplace_back (cpp:S6003)
This commit is contained in:
@@ -31,7 +31,7 @@ void gl::vao::setup_attrib(gl::buffer &buffer, int attrib, int size, int type, i
|
||||
else {
|
||||
if (attrib == 0)
|
||||
params.clear();
|
||||
params.push_back({buffer, attrib, size, type, stride, offset});
|
||||
params.emplace_back(buffer, attrib, size, type, stride, offset);
|
||||
active = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ std::vector<std::string> python_external_utils::PyObjectToStringArray(PyObject *
|
||||
return emptyIfError;
|
||||
}
|
||||
|
||||
result.push_back(std::string(str));
|
||||
result.emplace_back(str);
|
||||
Py_DECREF(item); // Decrease reference count for the item
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ void WriteLog(std::string_view str, logtype type, bool isError)
|
||||
const auto message = FormatLogMessage(str);
|
||||
|
||||
std::scoped_lock lock(logMutex);
|
||||
InfoStack.push_back({message, isError});
|
||||
InfoStack.emplace_back(message, isError);
|
||||
}
|
||||
|
||||
void ErrorLog(std::string_view str, logtype type)
|
||||
|
||||
@@ -572,16 +572,16 @@ void TSegment::render_lines(std::vector<gfx::basic_vertex> &out, float quality)
|
||||
glm::vec3 previous = FastGetPoint(0.0);
|
||||
|
||||
for (x = step; x <= 1.0f; x += step) {
|
||||
out.push_back(gfx::basic_vertex(previous, glm::vec3(0.0f), glm::vec2(0.0f)));
|
||||
out.emplace_back(previous, glm::vec3(0.0f), glm::vec2(0.0f));
|
||||
|
||||
previous = glm::vec3(FastGetPoint(x));
|
||||
out.push_back(gfx::basic_vertex(previous, glm::vec3(0.0f), glm::vec2(0.0f)));
|
||||
out.emplace_back(previous, glm::vec3(0.0f), glm::vec2(0.0f));
|
||||
}
|
||||
|
||||
out.push_back(gfx::basic_vertex(previous, glm::vec3(0.0f), glm::vec2(0.0f)));
|
||||
out.emplace_back(previous, glm::vec3(0.0f), glm::vec2(0.0f));
|
||||
|
||||
previous = glm::vec3(FastGetPoint(1.0));
|
||||
out.push_back(gfx::basic_vertex(previous, glm::vec3(0.0f), glm::vec2(0.0f)));
|
||||
out.emplace_back(previous, glm::vec3(0.0f), glm::vec2(0.0f));
|
||||
}
|
||||
|
||||
glm::vec3 TSegment::get_nearest_point(const glm::dvec3 &point, float quality) const
|
||||
|
||||
Reference in New Issue
Block a user