Skip to content

Commit

Permalink
In RepeatedField, rename members and use member accessors.
Browse files Browse the repository at this point in the history
Motivation: refactoring in preparation for small object optimization in RepeatedField.
PiperOrigin-RevId: 651446582
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jul 11, 2024
1 parent 77047d9 commit 7fa8718
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 98 deletions.
6 changes: 4 additions & 2 deletions src/google/protobuf/repeated_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "google/protobuf/repeated_field.h"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <string>

#include "absl/log/absl_check.h"
Expand All @@ -28,8 +30,8 @@ namespace protobuf {
template <>
PROTOBUF_EXPORT_TEMPLATE_DEFINE size_t
RepeatedField<absl::Cord>::SpaceUsedExcludingSelfLong() const {
size_t result = current_size_ * sizeof(absl::Cord);
for (int i = 0; i < current_size_; i++) {
size_t result = size() * sizeof(absl::Cord);
for (int i = 0; i < size(); i++) {
// Estimate only.
result += Get(i).size();
}
Expand Down
Loading

0 comments on commit 7fa8718

Please sign in to comment.