Fixes for String{Resize|Append}AndOverwrite

- StringAppendAndOverwrite() should always call StringResizeAndOverwrite()
    with at least capacity() in case the standard library decides to shrink
    the buffer (Fixes #1965)
  - Small refactor to make the minimum growth an addition for clarity and
    to make it easier to test 1.5x growth in the future
  - Turn an ABSL_HARDENING_ASSERT into a ThrowStdLengthError
  - Add a missing std::move

PiperOrigin-RevId: 826107106
Change-Id: I73ee3e98daa10161aa9023b2a879f6178ebedbcf
This commit is contained in:
Derek Mauro
2025-10-30 11:05:05 -07:00
committed by Copybara-Service
parent 01a4ea7fbb
commit f43bcc04d9
4 changed files with 16 additions and 6 deletions

View File

@@ -182,6 +182,7 @@ cc_library(
":resize_and_overwrite",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:throw_delegate",
],
)