From 12c8f3005e202b31a8e0ff3816ce9d714a269046 Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Wed, 25 Jul 2018 14:24:21 +0000 Subject: Remove stringref::c_str() The expected semantics of c_str() (a null-terminated string) cannot be satisfied with a string reference, so remove the function entirely to prevent people from using it in buggy ways. Replaces c_str() with data() in places where it is presumed safe, otherwise constructs temporary string instances. Certain callsites have been de-stringref'd in favor of regular strings, in particular where C APIs have been transitively called. The vast majority of these were called with string parameters anyway, so should not cause much extra allocation. --- searchcore/src/tests/proton/summaryengine/summaryengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searchcore/src/tests/proton/summaryengine') diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index 8206eba6350..0a520044985 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -68,7 +68,7 @@ public: DocsumReply::Docsum docsum; docsum.docid = 10 + i; docsum.gid = h.gid; - docsum.setData(_reply.c_str(), _reply.size()); + docsum.setData(_reply.data(), _reply.size()); retval->docsums.push_back(docsum); } return retval; -- cgit v1.2.3