Cleanup: Remove unnecessary braces for container default constructors

These containers (Set, Vector, Map, Span), etc. have default constructors,
making the braces unnecessary for default initialization. Better to depend
on that consistently rather than having braces in some places and not others.
This commit is contained in:
Hans Goudey
2024-03-07 09:30:15 -05:00
parent d727738157
commit c8efea42e1
8 changed files with 14 additions and 14 deletions

View File

@@ -45,7 +45,7 @@ bool AssetStorage::remove_asset(AssetRepresentation &asset)
void AssetStorage::remap_ids_and_remove_invalid(const blender::bke::id::IDRemapper &mappings)
{
Set<AssetRepresentation *> removed_assets{};
Set<AssetRepresentation *> removed_assets;
for (auto &asset_ptr : local_id_assets_) {
AssetRepresentation &asset = *asset_ptr;

View File

@@ -49,7 +49,7 @@ static blender::Vector<uint8_t> filtered_rows_from_thumb(const Thumbnail *thumb)
/* In the image data sent to the compression step, each scan-line is preceded by a filter type
* byte containing the numeric code of the filter algorithm used for that scan-line. */
const size_t line_size = thumb->width * 4;
blender::Vector<uint8_t> filtered{};
blender::Vector<uint8_t> filtered;
size_t final_size = thumb->height * (line_size + 1);
filtered.reserve(final_size);
for (int i = 0; i < thumb->height; i++) {
@@ -88,7 +88,7 @@ std::optional<blender::Vector<uint8_t>> blendthumb_create_png_data_from_thumb(
}
/* Create `IDAT` chunk data. */
blender::Vector<uint8_t> image_data{};
blender::Vector<uint8_t> image_data;
{
auto image_data_opt = zlib_compress(filtered_rows_from_thumb(thumb));
if (image_data_opt == std::nullopt) {
@@ -98,7 +98,7 @@ std::optional<blender::Vector<uint8_t>> blendthumb_create_png_data_from_thumb(
}
/* Create the IHDR chunk data. */
blender::Vector<uint8_t> ihdr_data{};
blender::Vector<uint8_t> ihdr_data;
{
const size_t ihdr_data_final_size = 4 + 4 + 5;
ihdr_data.reserve(ihdr_data_final_size);
@@ -115,7 +115,7 @@ std::optional<blender::Vector<uint8_t>> blendthumb_create_png_data_from_thumb(
}
/* Join it all together to create a PNG image. */
blender::Vector<uint8_t> png_buf{};
blender::Vector<uint8_t> png_buf;
{
const size_t png_buf_final_size = (
/* Header. */

View File

@@ -474,7 +474,7 @@ static void build_mesh_positions(const CurvesInfo &curves_info,
}
const Span<float3> tangents = curves_info.main.evaluated_tangents();
const Span<float3> normals = curves_info.main.evaluated_normals();
Span<float> radii_eval = {};
Span<float> radii_eval;
if (const GVArray radii = *curves_info.main.attributes().lookup("radius", AttrDomain::Point)) {
radii_eval = evaluate_attribute(radii, curves_info.main, eval_buffer).typed<float>();
}

View File

@@ -616,7 +616,7 @@ struct UnusedIDsData {
std::array<int, INDEX_ID_MAX> *num_local;
std::array<int, INDEX_ID_MAX> *num_linked;
blender::Set<ID *> unused_ids{};
blender::Set<ID *> unused_ids;
UnusedIDsData(Main *bmain, const int id_tag, LibQueryUnusedIDsData &parameters)
: bmain(bmain),

View File

@@ -158,7 +158,7 @@ struct SceneState {
bool xray_mode = false;
DRWState cull_state = DRW_STATE_NO_DRAW;
Vector<float4> clip_planes = {};
Vector<float4> clip_planes;
float4 background_color = float4(0);
@@ -293,7 +293,7 @@ class MeshPass : public PassMain {
private:
using TextureSubPassKey = std::pair<GPUTexture *, eGeometryType>;
Map<TextureSubPassKey, PassMain::Sub *> texture_subpass_map_ = {};
Map<TextureSubPassKey, PassMain::Sub *> texture_subpass_map_;
PassMain::Sub *passes_[geometry_type_len][shader_type_len] = {{nullptr}};

View File

@@ -21,7 +21,7 @@ static bool get_matcap_tx(Texture &matcap_tx, StudioLight &studio_light)
if (matcap_diffuse && matcap_diffuse->float_buffer.data) {
int layers = 1;
float *buffer = matcap_diffuse->float_buffer.data;
Vector<float> combined_buffer = {};
Vector<float> combined_buffer;
if (matcap_specular && matcap_specular->float_buffer.data) {
int size = matcap_diffuse->x * matcap_diffuse->y * 4;

View File

@@ -96,8 +96,8 @@ void ShadowPass::ShadowView::setup(View &view, float3 light_direction, bool forc
float4 frustum_planes[6];
DRW_culling_frustum_planes_get(nullptr, (float(*)[4])frustum_planes);
Vector<float4> faces_result = {};
Vector<float3> corners_result = {};
Vector<float4> faces_result;
Vector<float3> corners_result;
/* "Unlit" frustum faces are left "as-is" */

View File

@@ -100,10 +100,10 @@ class OverrideIDHierarchyBuilder {
const ID &override_root_id_;
/* The ancestor IDs leading to the current ID, to avoid IDs recursing into themselves. Changes
* with every level of recursion. */
Set<const ID *> parent_ids{};
Set<const ID *> parent_ids;
/* The IDs that were already added to #parent_te, to avoid duplicates. Entirely new set with
* every level of recursion. */
Set<const ID *> sibling_ids{};
Set<const ID *> sibling_ids;
};
public: