From e3b6f6c01699f15ee07f1caab6cd19cb5acc72a8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 19 Apr 2018 20:10:40 -0400 Subject: glsl_shader_decompiler: Use std::string_view instead of std::string for AddLine() This function doesn't need to take ownership of the string data being given to it, considering all we do is append the characters to the internal string instance. Instead, use a string view to simply reference the string data without any potential heap allocation. Now anything that is a raw const char* won't need to be converted to a std::string before appending. --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 3 ++- 1 file changed, 2 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 c55febbfa..22a413b73 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "common/assert.h" #include "common/common_types.h" #include "video_core/engines/shader_bytecode.h" @@ -109,7 +110,7 @@ private: class ShaderWriter { public: - void AddLine(const std::string& text) { + void AddLine(std::string_view text) { DEBUG_ASSERT(scope >= 0); if (!text.empty()) { AppendIndentation(); -- cgit v1.2.3