mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 12:28:13 -04:00
fix: pass some arguments by const ref instead of by value
This commit is contained in:
parent
e5a52e5ea4
commit
b5d3e857e7
@ -477,15 +477,16 @@ class granular_vector_adapter : private GranularityPolicy {
|
||||
|
||||
size_t size() const { return this->bytes_to_frames(v_.size()); }
|
||||
|
||||
void append(granular_span_adapter<T const, GranularityPolicy> span) {
|
||||
void append(granular_span_adapter<T const, GranularityPolicy> const& span) {
|
||||
auto raw = span.raw();
|
||||
auto off = v_.size();
|
||||
v_.resize(off + raw.size());
|
||||
::memcpy(v_.data() + off, raw.data(), raw.size());
|
||||
}
|
||||
|
||||
int compare(size_t offset,
|
||||
granular_span_adapter<T const, GranularityPolicy> span) const {
|
||||
int compare(
|
||||
size_t offset,
|
||||
granular_span_adapter<T const, GranularityPolicy> const& span) const {
|
||||
auto raw = span.raw();
|
||||
return std::memcmp(v_.data() + this->frames_to_bytes(offset), raw.data(),
|
||||
raw.size());
|
||||
@ -594,7 +595,7 @@ class segmenter_progress : public progress::context {
|
||||
using status = progress::context::status;
|
||||
|
||||
segmenter_progress(std::string context, size_t total_size)
|
||||
: context_{context}
|
||||
: context_{std::move(context)}
|
||||
, bytes_total_{total_size} {}
|
||||
|
||||
status get_status() const override {
|
||||
@ -757,8 +758,8 @@ class segment_match : private GranularityPolicy {
|
||||
, offset_{off} {}
|
||||
|
||||
void verify_and_extend(
|
||||
granular_span_adapter<uint8_t const, GranularityPolicy> data, size_t pos,
|
||||
size_t len, size_t begin, size_t end);
|
||||
granular_span_adapter<uint8_t const, GranularityPolicy> const& data,
|
||||
size_t pos, size_t len, size_t begin, size_t end);
|
||||
|
||||
bool operator<(segment_match const& rhs) const {
|
||||
return size_ < rhs.size_ ||
|
||||
@ -851,8 +852,8 @@ void active_block<LoggerPolicy, GranularityPolicy>::append_bytes(
|
||||
|
||||
template <typename LoggerPolicy, typename GranularityPolicy>
|
||||
void segment_match<LoggerPolicy, GranularityPolicy>::verify_and_extend(
|
||||
granular_span_adapter<uint8_t const, GranularityPolicy> data, size_t pos,
|
||||
size_t len, size_t begin, size_t end) {
|
||||
granular_span_adapter<uint8_t const, GranularityPolicy> const& data,
|
||||
size_t pos, size_t len, size_t begin, size_t end) {
|
||||
auto v = this->template create<
|
||||
granular_vector_adapter<uint8_t, GranularityPolicy>>(
|
||||
block_->data()->vec());
|
||||
|
@ -285,7 +285,8 @@ class similarity_ordering_ final : public similarity_ordering::impl {
|
||||
basic_cluster_tree_node<
|
||||
basic_cluster<Bits, BitsType, CountsType, index_value_type>>& node,
|
||||
basic_array_similarity_element_view<Bits, BitsType> const& ev,
|
||||
duplicates_map& dup, index_type& ordered, std::string indent) const;
|
||||
duplicates_map& dup, index_type& ordered,
|
||||
std::string const& indent) const;
|
||||
|
||||
template <size_t Bits, typename BitsType>
|
||||
void order_impl(
|
||||
@ -563,7 +564,7 @@ void similarity_ordering_<LoggerPolicy>::collect_rec(
|
||||
basic_cluster_tree_node<
|
||||
basic_cluster<Bits, BitsType, CountsType, index_value_type>>& node,
|
||||
basic_array_similarity_element_view<Bits, BitsType> const& ev,
|
||||
duplicates_map& dup, index_type& ordered, std::string indent) const {
|
||||
duplicates_map& dup, index_type& ordered, std::string const& indent) const {
|
||||
if (node.is_leaf()) {
|
||||
for (auto e : node.cluster().index) {
|
||||
LOG_TRACE << opts_.context << indent << " " << ev.description(e)
|
||||
|
@ -61,7 +61,7 @@ std::string random_string(size_t size) {
|
||||
return data;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> make_data(std::string s) {
|
||||
std::vector<uint8_t> make_data(std::string const& s) {
|
||||
std::vector<uint8_t> rv(s.size());
|
||||
std::memcpy(rv.data(), s.data(), s.size());
|
||||
return rv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user