summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei Borzenkov <[email protected]>2024-02-05 13:29:43 +0300
committerGitHub <[email protected]>2024-02-05 13:29:43 +0300
commit7d4974a9ed846ebd5d339febbe5e557d406b80e2 (patch)
tree5eb3c1270fdd3e4af7cd331ca8752df632ceaf7d
parentb5a8005d772b32ee8507efb6a89ae7871a3eb828 (diff)
Fix some unnecessary copies reported by coverity (#1578)
-rw-r--r--ydb/core/tablet_flat/flat_boot_blobs.h2
-rw-r--r--ydb/core/tablet_flat/flat_dbase_naked.h2
-rw-r--r--ydb/core/tablet_flat/flat_part_store.h2
-rw-r--r--ydb/core/tablet_flat/flat_sausage_packet.h2
-rw-r--r--ydb/core/tablet_flat/flat_sausage_slicer.h2
-rw-r--r--ydb/core/tablet_flat/flat_writer_bundle.h2
-rw-r--r--ydb/core/tablet_flat/logic_redo_queue.h2
-rw-r--r--ydb/core/tablet_flat/ut/ut_proto.cpp2
8 files changed, 8 insertions, 8 deletions
diff --git a/ydb/core/tablet_flat/flat_boot_blobs.h b/ydb/core/tablet_flat/flat_boot_blobs.h
index d461cae5317..d7cbb25811e 100644
--- a/ydb/core/tablet_flat/flat_boot_blobs.h
+++ b/ydb/core/tablet_flat/flat_boot_blobs.h
@@ -34,7 +34,7 @@ namespace NBoot {
Env->Finish(this);
}
- const TVector<TLogoBlobID> Blobs() const
+ const TVector<TLogoBlobID>& Blobs() const
{
return State.GetBlobs();
}
diff --git a/ydb/core/tablet_flat/flat_dbase_naked.h b/ydb/core/tablet_flat/flat_dbase_naked.h
index 5e6f8b179eb..e67d6da7b09 100644
--- a/ydb/core/tablet_flat/flat_dbase_naked.h
+++ b/ydb/core/tablet_flat/flat_dbase_naked.h
@@ -131,7 +131,7 @@ namespace NTable {
, Redo(*this)
, Scheme(scheme)
{
- for (auto it : Scheme->Tables) {
+ for (const auto& it : Scheme->Tables) {
auto *mine = edges ? edges->FindPtr(it.first) : nullptr;
MakeTable(it.first, mine ? *mine : TSnapEdge{ })->SetScheme(it.second);
diff --git a/ydb/core/tablet_flat/flat_part_store.h b/ydb/core/tablet_flat/flat_part_store.h
index 9727b5e98db..86593682bf1 100644
--- a/ydb/core/tablet_flat/flat_part_store.h
+++ b/ydb/core/tablet_flat/flat_part_store.h
@@ -189,7 +189,7 @@ public:
}
void SaveAllBlobIdsTo(TVector<TLogoBlobID>& vec) const override {
- for (auto blobId : DataId.Blobs()) {
+ for (const auto& blobId : DataId.Blobs()) {
vec.emplace_back(blobId);
}
}
diff --git a/ydb/core/tablet_flat/flat_sausage_packet.h b/ydb/core/tablet_flat/flat_sausage_packet.h
index d876b5a897f..30ed8fecbdc 100644
--- a/ydb/core/tablet_flat/flat_sausage_packet.h
+++ b/ydb/core/tablet_flat/flat_sausage_packet.h
@@ -62,7 +62,7 @@ namespace NPageCollection {
LargeGlobId.MaterializeTo(vec);
{
- const auto &blobs = Meta.Blobs();
+ auto blobs = Meta.Blobs();
vec.insert(vec.end(), blobs.begin(), blobs.end());
}
}
diff --git a/ydb/core/tablet_flat/flat_sausage_slicer.h b/ydb/core/tablet_flat/flat_sausage_slicer.h
index 98820ec92e4..eaa85736e5b 100644
--- a/ydb/core/tablet_flat/flat_sausage_slicer.h
+++ b/ydb/core/tablet_flat/flat_sausage_slicer.h
@@ -55,7 +55,7 @@ namespace NPageCollection {
refs.push_back({ largeGlobId.Lead, std::move(body) });
} else {
ui32 off = 0;
- for (auto blobId : largeGlobId.Blobs()) {
+ for (const auto& blobId : largeGlobId.Blobs()) {
const ui32 chunk = Min(Block, size - off);
Y_DEBUG_ABORT_UNLESS(chunk == blobId.BlobSize());
refs.push_back({ blobId, body.substr(off, chunk) });
diff --git a/ydb/core/tablet_flat/flat_writer_bundle.h b/ydb/core/tablet_flat/flat_writer_bundle.h
index 61af2684118..692ac1ea135 100644
--- a/ydb/core/tablet_flat/flat_writer_bundle.h
+++ b/ydb/core/tablet_flat/flat_writer_bundle.h
@@ -129,7 +129,7 @@ namespace NWriter {
size_t offset = 0;
size_t left = body.size();
- for (auto blobId : largeGlobId.Blobs()) {
+ for (const auto& blobId : largeGlobId.Blobs()) {
const NPageCollection::TGlobId glob(blobId, largeGlobId.Group);
const auto chunk = glob.Bytes();
const auto slice = body.Slice(offset, chunk);
diff --git a/ydb/core/tablet_flat/logic_redo_queue.h b/ydb/core/tablet_flat/logic_redo_queue.h
index faa74feecc7..f1264f1b5c5 100644
--- a/ydb/core/tablet_flat/logic_redo_queue.h
+++ b/ydb/core/tablet_flat/logic_redo_queue.h
@@ -100,7 +100,7 @@ namespace NRedo {
while (TAutoPtr<TEntry> entry = was->Pop()) {
if (entry->FilterTables(Edges)) {
- for (auto blobId : entry->LargeGlobId.Blobs()) {
+ for (const auto& blobId : entry->LargeGlobId.Blobs()) {
LogoBlobIDFromLogoBlobID(blobId, logos->Add());
}
diff --git a/ydb/core/tablet_flat/ut/ut_proto.cpp b/ydb/core/tablet_flat/ut/ut_proto.cpp
index aa1dac4328d..cd9b4e1c9da 100644
--- a/ydb/core/tablet_flat/ut/ut_proto.cpp
+++ b/ydb/core/tablet_flat/ut/ut_proto.cpp
@@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(NProto /* executor binary units */) {
UNIT_ASSERT_VALUES_EQUAL(largeGlobId.BlobCount(), 8u);
ui32 num = 0;
- for (auto logo : largeGlobId.Blobs()) {
+ for (const auto& logo : largeGlobId.Blobs()) {
++num;
LogoBlobIDFromLogoBlobID(logo, pageCollection.AddMetaId());