summaryrefslogtreecommitdiff
path: root/absl/strings
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-06-06 11:26:39 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-06-06 11:27:17 -0700
commit91b8bfab44baf5c89efabd6f6b8b33f6a42f39b6 (patch)
tree45d0ac9e911765d42563042fc2168a476fc691d8 /absl/strings
parent800a88de73b89926129c63276f133d0f3d375d4a (diff)
Add ABSL_HARDENING_ASSERTs to CordBuffer::SetLength() and
CordBuffer::IncreaseLengthBy() PiperOrigin-RevId: 453243686 Change-Id: If109da6be651006d4d9820bcc10eddfb56deaea2
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/cord_buffer.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/strings/cord_buffer.h b/absl/strings/cord_buffer.h
index 4f4bdc0e..56a6ce6f 100644
--- a/absl/strings/cord_buffer.h
+++ b/absl/strings/cord_buffer.h
@@ -32,6 +32,7 @@
#include <utility>
#include "absl/base/config.h"
+#include "absl/base/macros.h"
#include "absl/numeric/bits.h"
#include "absl/strings/internal/cord_internal.h"
#include "absl/strings/internal/cord_rep_flat.h"
@@ -548,7 +549,7 @@ inline size_t CordBuffer::length() const {
}
inline void CordBuffer::SetLength(size_t length) {
- assert(length <= capacity());
+ ABSL_HARDENING_ASSERT(length <= capacity());
if (rep_.is_short()) {
rep_.set_short_length(length);
} else {
@@ -557,7 +558,7 @@ inline void CordBuffer::SetLength(size_t length) {
}
inline void CordBuffer::IncreaseLengthBy(size_t n) {
- assert(n <= capacity() && length() + n <= capacity());
+ ABSL_HARDENING_ASSERT(n <= capacity() && length() + n <= capacity());
if (rep_.is_short()) {
rep_.add_short_length(n);
} else {