diff options
author | Abseil Team <absl-team@google.com> | 2020-12-14 08:53:54 -0800 |
---|---|---|
committer | Mark Barolak <mbar@google.com> | 2020-12-14 13:16:42 -0500 |
commit | 52acfe6fc6b8bb9b1b7854993dd0fb33f0f3c4af (patch) | |
tree | dffd40cf776d2e0e319a1910838a7ee7606958dd /absl/strings/cord.cc | |
parent | 1918ad2ae38aa32c74b558b322479a8efdd76363 (diff) |
Export of internal Abseil changes
--
751781aa5b9e998f84a8a7e00789c80d3338730e by Abseil Team <absl-team@google.com>:
Fix attributes.h compilation with -Wundef flag in C
PiperOrigin-RevId: 347394915
--
66070a8166b0e1a61236b954d07fbb378f4f990b by Abseil Team <absl-team@google.com>:
Revert the usage of variant<> in Cord iterator and reader.
The introduction of the variant may lead to some missed compiler optimizations.
PiperOrigin-RevId: 347384869
GitOrigin-RevId: 751781aa5b9e998f84a8a7e00789c80d3338730e
Change-Id: Ibf1190d498a6f968f2ea9b89467ccfb5224dafa8
Diffstat (limited to 'absl/strings/cord.cc')
-rw-r--r-- | absl/strings/cord.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/absl/strings/cord.cc b/absl/strings/cord.cc index f87f4882..8d51c750 100644 --- a/absl/strings/cord.cc +++ b/absl/strings/cord.cc @@ -1299,8 +1299,7 @@ void Cord::CopyToArraySlowPath(char* dst) const { } Cord::ChunkIterator& Cord::ChunkIterator::AdvanceStack() { - assert(absl::holds_alternative<Stack>(context_)); - auto& stack_of_right_children = absl::get<Stack>(context_); + auto& stack_of_right_children = stack_of_right_children_; if (stack_of_right_children.empty()) { assert(!current_chunk_.empty()); // Called on invalid iterator. // We have reached the end of the Cord. @@ -1357,8 +1356,7 @@ Cord Cord::ChunkIterator::AdvanceAndReadBytes(size_t n) { } return subcord; } - assert(absl::holds_alternative<Stack>(context_)); - auto& stack_of_right_children = absl::get<Stack>(context_); + auto& stack_of_right_children = stack_of_right_children_; if (n < current_chunk_.size()) { // Range to read is a proper subrange of the current chunk. assert(current_leaf_ != nullptr); @@ -1461,7 +1459,7 @@ void Cord::ChunkIterator::AdvanceBytesSlowPath(size_t n) { n -= current_chunk_.size(); bytes_remaining_ -= current_chunk_.size(); - if (!absl::holds_alternative<Stack>(context_)) { + if (stack_of_right_children_.empty()) { // We have reached the end of the Cord. assert(bytes_remaining_ == 0); return; @@ -1470,8 +1468,7 @@ void Cord::ChunkIterator::AdvanceBytesSlowPath(size_t n) { // Process the next node(s) on the stack, skipping whole subtrees depending on // their length and how many bytes we are advancing. CordRep* node = nullptr; - assert(absl::holds_alternative<Stack>(context_)); - auto& stack_of_right_children = absl::get<Stack>(context_); + auto& stack_of_right_children = stack_of_right_children_; while (!stack_of_right_children.empty()) { node = stack_of_right_children.back(); stack_of_right_children.pop_back(); |