From cfc6f9eb18e701f5be601b95c45004e8cf7fbc81 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 7 Aug 2020 12:17:29 +0200 Subject: [PATCH] Clang-Tidy: Address readability-redundant-string-init --- .clang-tidy | 1 - .../blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc | 2 +- source/blender/depsgraph/intern/depsgraph_tag.cc | 2 +- source/blender/imbuf/intern/openexr/openexr_api.cpp | 2 +- source/blender/io/collada/AnimationExporter.cpp | 2 +- source/blender/io/collada/collada_internal.cpp | 2 +- source/blender/io/collada/collada_utils.cpp | 3 +-- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 7cf2830d438..b166dc931ca 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -17,7 +17,6 @@ Checks: > -readability-redundant-preprocessor, -readability-function-size, -readability-function-size, - -readability-redundant-string-init, -readability-redundant-member-init, -readability-const-return-type, -readability-static-accessed-through-instance, diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc index 515b53297b9..16bdc2d6115 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc @@ -83,7 +83,7 @@ string gnuplotify_id_code(const string &name) string gnuplotify_name(const string &name) { - string result = ""; + string result; const int length = name.length(); for (int i = 0; i < length; i++) { const char ch = name[i]; diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 1d8fba21857..7c201de66f2 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -429,7 +429,7 @@ string stringify_update_bitfield(int flag) if (flag == 0) { return "LEGACY_0"; } - string result = ""; + string result; int current_flag = flag; /* Special cases to avoid ALL flags form being split into * individual bits. */ diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 9b614eab0dc..a781c616b1c 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -741,7 +741,7 @@ static void imb_exr_get_views(MultiPartInputFile &file, StringVector &views) else { for (int p = 0; p < file.parts(); p++) { - std::string view = ""; + std::string view; if (file.header(p).hasView()) { view = file.header(p).view(); } diff --git a/source/blender/io/collada/AnimationExporter.cpp b/source/blender/io/collada/AnimationExporter.cpp index c25b4ea543b..1515e5413f0 100644 --- a/source/blender/io/collada/AnimationExporter.cpp +++ b/source/blender/io/collada/AnimationExporter.cpp @@ -230,7 +230,7 @@ void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler & std::string name = encode_xml(id_name(ob)); std::string action_name = (action == NULL) ? name + "-action" : id_name(action); std::string channel_type = "transform"; - std::string axis = ""; + std::string axis; std::string id = bc_get_action_id(action_name, name, channel_type, axis); std::string target = translate_id(name) + '/' + channel_type; diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp index f123e8ea31f..b3fa9ba1251 100644 --- a/source/blender/io/collada/collada_internal.cpp +++ b/source/blender/io/collada/collada_internal.cpp @@ -277,7 +277,7 @@ std::string encode_xml(std::string xml) {'<', "<"}, {'>', ">"}, {'"', """}, {'\'', "'"}, {'&', "&"}}; std::map::const_iterator it; - std::string encoded_xml = ""; + std::string encoded_xml; for (unsigned int i = 0; i < xml.size(); i++) { char c = xml.at(i); diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index 2c54a49198a..df35a1d2780 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -672,8 +672,7 @@ void BoneExtended::set_bone_layers(std::string layerString, std::vector