Skip to content

Commit

Permalink
Simplify RandomAccessRepeatedFieldAccessor hierarchy via more code …
Browse files Browse the repository at this point in the history
…reuse

In particular, reworked `MapFieldAccessor` to be a minimalistic subclass of `RepeatedPtrFieldMessageAccessor`, with only 2 overrides of transitive virtual APIs inherited from `RepeatedPtrFieldWrapper<>`.

PiperOrigin-RevId: 693813512
  • Loading branch information
CEL Dev Team authored and copybara-github committed Nov 6, 2024
1 parent 0834a15 commit 2304cdd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 5 deletions.
1 change: 0 additions & 1 deletion common/values/parsed_map_field_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ ParsedMapFieldValue ParsedMapFieldValue::Clone(Allocator<> allocator) const {
auto cloned_field =
cloned->GetReflection()->GetMutableRepeatedFieldRef<google::protobuf::Message>(
cel::to_address(cloned), field_);
cloned_field.Reserve(field.size());
cloned_field.CopyFrom(field);
return ParsedMapFieldValue(std::move(cloned), field_);
}
Expand Down
1 change: 0 additions & 1 deletion common/values/parsed_repeated_field_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ ParsedRepeatedFieldValue ParsedRepeatedFieldValue::Clone(
auto cloned_field =
cloned->GetReflection()->GetMutableRepeatedFieldRef<google::protobuf::Message>(
cel::to_address(cloned), field_);
cloned_field.Reserve(field.size());
cloned_field.CopyFrom(field);
return ParsedRepeatedFieldValue(std::move(cloned), field_);
}
Expand Down
3 changes: 0 additions & 3 deletions internal/well_known_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1538,9 +1538,6 @@ void ListValueReflection::ReserveValues(absl::Nonnull<google::protobuf::Message*
int capacity) const {
ABSL_DCHECK(IsInitialized());
ABSL_DCHECK_EQ(message->GetDescriptor(), descriptor_);
if (capacity > 0) {
MutableValues(message).Reserve(capacity);
}
}

absl::StatusOr<ListValueReflection> GetListValueReflection(
Expand Down

0 comments on commit 2304cdd

Please sign in to comment.