mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 14:24:58 +01: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 {
|
else {
|
||||||
if (attrib == 0)
|
if (attrib == 0)
|
||||||
params.clear();
|
params.clear();
|
||||||
params.push_back({buffer, attrib, size, type, stride, offset});
|
params.emplace_back(buffer, attrib, size, type, stride, offset);
|
||||||
active = nullptr;
|
active = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ std::vector<std::string> python_external_utils::PyObjectToStringArray(PyObject *
|
|||||||
return emptyIfError;
|
return emptyIfError;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push_back(std::string(str));
|
result.emplace_back(str);
|
||||||
Py_DECREF(item); // Decrease reference count for the item
|
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);
|
const auto message = FormatLogMessage(str);
|
||||||
|
|
||||||
std::scoped_lock lock(logMutex);
|
std::scoped_lock lock(logMutex);
|
||||||
InfoStack.push_back({message, isError});
|
InfoStack.emplace_back(message, isError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorLog(std::string_view str, logtype type)
|
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);
|
glm::vec3 previous = FastGetPoint(0.0);
|
||||||
|
|
||||||
for (x = step; x <= 1.0f; x += step) {
|
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));
|
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));
|
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
|
glm::vec3 TSegment::get_nearest_point(const glm::dvec3 &point, float quality) const
|
||||||
|
|||||||
Reference in New Issue
Block a user