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/index/indexmanager_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searchcore/src/tests/proton/index/indexmanager_test.cpp') diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index 6a098667be8..d88199e6ae8 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -662,7 +662,7 @@ TEST_F("requireThatSerialNumberIsReadOnLoad", Fixture) { void crippleFusion(uint32_t fusionId) { vespalib::asciistream ost; ost << index_dir << "/index.flush." << fusionId << "/serial.dat"; - FastOS_File(ost.str().c_str()).Delete(); + FastOS_File(ost.str().data()).Delete(); } TEST_F("requireThatFailedFusionIsRetried", Fixture) { -- cgit v1.2.3