From a1cee9f97c822a1b279b1b00a8fc7b3fd1046677 Mon Sep 17 00:00:00 2001 From: Duarte Nunes Date: Sun, 24 Jul 2016 22:02:28 +0000 Subject: [PATCH] sstables: Remove superfluous call to check_static() When building a column we're calling check_static() two times; refector things a bit so that this doesn't happen and we reuse the previous calculation. Signed-off-by: Duarte Nunes Message-Id: <1469397748-7987-1-git-send-email-duarte@scylladb.com> --- sstables/partition.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sstables/partition.cc b/sstables/partition.cc index 8f7539d11a..ecc060d55c 100644 --- a/sstables/partition.cc +++ b/sstables/partition.cc @@ -166,7 +166,11 @@ private: } static bytes_view fix_static_name(bytes_view col) { - if (check_static(col)) { + return fix_static_name(col, check_static(col)); + } + + static bytes_view fix_static_name(bytes_view col, bool is_static) { + if(is_static) { col.remove_prefix(static_size); } return col; @@ -181,7 +185,7 @@ private: } column(const schema& schema, bytes_view col) : is_static(check_static(col)) - , col_name(fix_static_name(col)) + , col_name(fix_static_name(col, is_static)) , clustering(extract_clustering_key(schema)) , collection_extra_data(is_collection(schema) ? pop_back(clustering) : bytes()) // collections are not supported with COMPACT STORAGE, so this is fine , cell(!schema.is_dense() ? pop_back(clustering) : (*(schema.regular_begin())).name()) // dense: cell name is not provided. It is the only regular column