From a7dd736d039f587211dbb595ae59aa161ceaed5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chojnowski?= Date: Fri, 27 Nov 2020 12:36:20 +0100 Subject: [PATCH] types: validate sets without linearizing We can validate collections directly from fragmented buffers now. --- types.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/types.cc b/types.cc index 10e8a0a984..3667c44c82 100644 --- a/types.cc +++ b/types.cc @@ -1221,7 +1221,8 @@ set_type_impl::is_value_compatible_with_frozen(const collection_type_impl& previ return is_compatible_with(previous); } -static void validate_aux(const set_type_impl& t, bytes_view v, cql_serialization_format sf) { +template +static void validate_aux(const set_type_impl& t, View v, cql_serialization_format sf) { auto nr = read_collection_size(v, sf); for (int i = 0; i != nr; ++i) { t.get_elements_type()->validate(read_collection_value(v, sf), sf); @@ -1568,9 +1569,7 @@ struct validate_visitor { validate_aux(t, v, sf); } void operator()(const set_type_impl& t) { - with_linearized(v, [this, &t] (bytes_view bv) { - validate_aux(t, bv, sf); - }); + validate_aux(t, v, sf); } void operator()(const list_type_impl& t) { with_linearized(v, [this, &t] (bytes_view bv) {