From 4ef392906b4e91433587eab6a2654908081aea6a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 19 Apr 2018 19:59:20 -0400 Subject: glsl_shader_decompiler: Append indentation without constructing a separate std::string The interface of std::string already lets us append N copies of a character to an existing string. --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 6233ee358..389a23edb 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -112,7 +112,7 @@ public: void AddLine(const std::string& text) { DEBUG_ASSERT(scope >= 0); if (!text.empty()) { - shader_source += std::string(static_cast(scope) * 4, ' '); + AppendIndentation(); } shader_source += text + '\n'; } @@ -124,6 +124,10 @@ public: int scope = 0; private: + void AppendIndentation() { + shader_source.append(static_cast(scope) * 4, ' '); + } + std::string shader_source; }; -- cgit v1.2.3