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 <duarte@scylladb.com>
Message-Id: <1469397748-7987-1-git-send-email-duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2016-07-24 22:02:28 +00:00
parent 0ae7347d8e
commit a1cee9f97c

View File

@@ -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