KeDeng has uploaded this change for review. ( http://gerrit.cloudera.org:8080/23057
Change subject: [compile] Fix compiler warnings about temporary string references in loops ...................................................................... [compile] Fix compiler warnings about temporary string references in loops This patch resolves compiler warnings that occur when binding `const std::string&` references to temporary string objects constructed from string literals in range-based for loops. The warnings were of the form: warning: loop variable '...' of type 'const string&' binds to a temporary constructed from type 'const char* const' [-Wrange-loop-construct] Solution: Explicitly construct a vector<string> from the initializer list before looping. This ensures: 1. All strings are properly constructed before the loop 2. References bind to persistent objects in the vector 3. Avoids per-iteration copying of strings Key benefits: - Eliminates compiler warnings about temporary bindings - Maintains reference semantics for efficient access - Preserves original code structure and readability - No performance impact (small vectors, short strings) - Works with any initializer list size and content Change-Id: I32a9a043e7aade2c2c879472c13cbf2641daa7f3 --- M src/kudu/consensus/quorum_util-test.cc M src/kudu/tools/kudu-tool-test.cc M src/kudu/tserver/tablet_server-test.cc 3 files changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/57/23057/1 -- To view, visit http://gerrit.cloudera.org:8080/23057 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I32a9a043e7aade2c2c879472c13cbf2641daa7f3 Gerrit-Change-Number: 23057 Gerrit-PatchSet: 1 Gerrit-Owner: KeDeng <[email protected]>
