From 07ec30c95734bd6ab3d45bc5fc01d2602e73fc90 Mon Sep 17 00:00:00 2001 From: Kevin Gurney Date: Fri, 4 Aug 2023 10:29:35 -0400 Subject: [PATCH] Avoid creating an unnecessary temporary string value when creating ARROW_TABULAR_SCHEMA_UNKNOWN_FIELD_NAME error message. Co-authored-by: Sutou Kouhei --- matlab/src/cpp/arrow/matlab/tabular/proxy/schema.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/matlab/src/cpp/arrow/matlab/tabular/proxy/schema.cc b/matlab/src/cpp/arrow/matlab/tabular/proxy/schema.cc index 689ee187a6e68..f029f399cb773 100644 --- a/matlab/src/cpp/arrow/matlab/tabular/proxy/schema.cc +++ b/matlab/src/cpp/arrow/matlab/tabular/proxy/schema.cc @@ -32,13 +32,11 @@ namespace arrow::matlab::tabular::proxy { libmexclass::error::Error makeUnknownFieldNameError(const std::string& name) { using namespace libmexclass::error; - const std::string error_message_id = std::string{error::ARROW_TABULAR_SCHEMA_UNKNOWN_FIELD_NAME}; std::stringstream error_message_stream; error_message_stream << "Unknown field name: '"; error_message_stream << name; error_message_stream << "'."; - const std::string& error_message = error_message_stream.str(); - return Error{error_message_id, error_message}; + return Error{error::ARROW_TABULAR_SCHEMA_UNKNOWN_FIELD_NAME, error_message_stream.str()}; } libmexclass::error::Error makeEmptySchemaError() {