| 671 | } |
| 672 | |
| 673 | void ByteString::Construct(const ByteString& other, |
| 674 | absl::optional<Allocator<>> allocator) { |
| 675 | switch (other.GetKind()) { |
| 676 | case ByteStringKind::kSmall: |
| 677 | rep_.small = other.rep_.small; |
| 678 | if (allocator.has_value()) { |
| 679 | rep_.small.arena = allocator->arena(); |
| 680 | } |
| 681 | break; |
| 682 | case ByteStringKind::kMedium: |
| 683 | if (allocator.has_value() && |
| 684 | allocator->arena() != other.GetMediumArena()) { |
| 685 | SetMedium(allocator->arena(), other.GetMedium()); |
| 686 | } else { |
| 687 | rep_.medium = other.rep_.medium; |
| 688 | StrongRef(GetMediumReferenceCount()); |
| 689 | } |
| 690 | break; |
| 691 | case ByteStringKind::kLarge: |
| 692 | if (allocator.has_value() && allocator->arena() != nullptr) { |
| 693 | SetMedium(allocator->arena(), other.GetLarge()); |
| 694 | } else { |
| 695 | SetLarge(other.GetLarge()); |
| 696 | } |
| 697 | break; |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | void ByteString::Construct(ByteString& other, |
| 702 | absl::optional<Allocator<>> allocator) { |
nothing calls this directly
no test coverage detected