aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/benchmark
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-07-25 14:24:21 +0000
committerTor Brede Vekterli <vekterli@oath.com>2018-07-25 14:24:21 +0000
commit12c8f3005e202b31a8e0ff3816ce9d714a269046 (patch)
treea5d9ba0eedc49df2cea2dbdfea677c4c37ed3775 /searchlib/src/tests/attribute/benchmark
parente3af3d215feb1e416b27b92bbf421dde281f3a09 (diff)
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.
Diffstat (limited to 'searchlib/src/tests/attribute/benchmark')
-rw-r--r--searchlib/src/tests/attribute/benchmark/attributesearcher.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/searchlib/src/tests/attribute/benchmark/attributesearcher.h b/searchlib/src/tests/attribute/benchmark/attributesearcher.h
index f8cd614c48c..37f33803d27 100644
--- a/searchlib/src/tests/attribute/benchmark/attributesearcher.h
+++ b/searchlib/src/tests/attribute/benchmark/attributesearcher.h
@@ -126,7 +126,7 @@ AttributeFindSearcher<T>::doRun()
// build simple term query
vespalib::asciistream ss;
ss << _values[i % _values.size()].getValue();
- this->buildTermQuery(_query, _attrPtr->getName(), ss.str().c_str());
+ this->buildTermQuery(_query, _attrPtr->getName(), ss.str().data());
AttributeGuard guard(_attrPtr);
std::unique_ptr<AttributeVector::SearchContext> searchContext =
@@ -204,7 +204,7 @@ AttributeRangeSearcher::doRun()
// build simple range term query
vespalib::asciistream ss;
ss << "[" << iter.a() << ";" << iter.b() << "]";
- buildTermQuery(_query, _attrPtr->getName(), ss.str().c_str());
+ buildTermQuery(_query, _attrPtr->getName(), ss.str().data());
AttributeGuard guard(_attrPtr);
std::unique_ptr<AttributeVector::SearchContext> searchContext =