Remove vestigial variables in the DumpNode() helper in absl::Cord
Fixes #1636 (GCC -Wmaybe-uninitialized warning)
PiperOrigin-RevId: 617253727
Change-Id: I246cd21d8123d4dfa7780b1c4cac8ea1558a4067
diff --git a/absl/strings/cord.cc b/absl/strings/cord.cc
index f67326f..2b61bdf 100644
--- a/absl/strings/cord.cc
+++ b/absl/strings/cord.cc
@@ -1451,8 +1451,6 @@
static void DumpNode(absl::Nonnull<CordRep*> rep, bool include_data,
absl::Nonnull<std::ostream*> os, int indent) {
const int kIndentStep = 1;
- absl::InlinedVector<CordRep*, kInlinedVectorSize> stack;
- absl::InlinedVector<int, kInlinedVectorSize> indents;
for (;;) {
*os << std::setw(3) << rep->refcount.Get();
*os << " " << std::setw(7) << rep->length;
@@ -1477,26 +1475,23 @@
if (rep->IsExternal()) {
*os << "EXTERNAL [";
if (include_data)
- *os << absl::CEscape(std::string(rep->external()->base, rep->length));
+ *os << absl::CEscape(
+ absl::string_view(rep->external()->base, rep->length));
*os << "]\n";
} else if (rep->IsFlat()) {
*os << "FLAT cap=" << rep->flat()->Capacity() << " [";
if (include_data)
- *os << absl::CEscape(std::string(rep->flat()->Data(), rep->length));
+ *os << absl::CEscape(
+ absl::string_view(rep->flat()->Data(), rep->length));
*os << "]\n";
} else {
CordRepBtree::Dump(rep, /*label=*/"", include_data, *os);
}
}
if (leaf) {
- if (stack.empty()) break;
- rep = stack.back();
- stack.pop_back();
- indent = indents.back();
- indents.pop_back();
+ break;
}
}
- ABSL_INTERNAL_CHECK(indents.empty(), "");
}
static std::string ReportError(absl::Nonnull<CordRep*> root,