mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-22 15:52:13 +00:00
streamed_mutation: fix non-POD argument to C-style variadic function
Clang warns that passing a non-POD to a C-style variadic function will result in an abort(). That happens to be exactly what we want, but to silence the warning, use a template instead. Since templates aren't allowed in local classes, move the containing class to namespace scope.
This commit is contained in:
@@ -88,14 +88,20 @@ void mutation_fragment::destroy_data() noexcept
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct get_key_visitor {
|
||||
const clustering_key_prefix& operator()(const clustering_row& cr) { return cr.key(); }
|
||||
const clustering_key_prefix& operator()(const range_tombstone& rt) { return rt.start; }
|
||||
template <typename T>
|
||||
const clustering_key_prefix& operator()(const T&) { abort(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
const clustering_key_prefix& mutation_fragment::key() const
|
||||
{
|
||||
assert(has_key());
|
||||
struct get_key_visitor {
|
||||
const clustering_key_prefix& operator()(const clustering_row& cr) { return cr.key(); }
|
||||
const clustering_key_prefix& operator()(const range_tombstone& rt) { return rt.start; }
|
||||
const clustering_key_prefix& operator()(...) { abort(); }
|
||||
};
|
||||
return visit(get_key_visitor());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user