summaryrefslogtreecommitdiff
path: root/absl/strings/cord.h
diff options
context:
space:
mode:
authorGravatar Martijn Vels <mvels@google.com>2023-01-09 11:28:53 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-01-09 11:29:40 -0800
commit5169f3a45fdc1737379ebf11fb8f6c91daa11d68 (patch)
tree5352fea4d80834bdbffd256e51666c1521d42e43 /absl/strings/cord.h
parent708873b4912e31e2df33f261add6ff367c8a462c (diff)
Refactor InlineData to allow for memory sanitizer changes step 1
PiperOrigin-RevId: 500765473 Change-Id: Iaa3f9fdee6c9f4322bc8995b0d381cf1c8cb1349
Diffstat (limited to 'absl/strings/cord.h')
-rw-r--r--absl/strings/cord.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/absl/strings/cord.h b/absl/strings/cord.h
index 1349b115..8744ec58 100644
--- a/absl/strings/cord.h
+++ b/absl/strings/cord.h
@@ -815,7 +815,7 @@ class Cord {
InlineRep& operator=(const InlineRep& src);
InlineRep& operator=(InlineRep&& src) noexcept;
- explicit constexpr InlineRep(cord_internal::InlineData data);
+ explicit constexpr InlineRep(absl::string_view sv, CordRep* rep);
void Swap(InlineRep* rhs);
bool empty() const;
@@ -1106,8 +1106,8 @@ Cord MakeCordFromExternal(absl::string_view data, Releaser&& releaser) {
return cord;
}
-constexpr Cord::InlineRep::InlineRep(cord_internal::InlineData data)
- : data_(data) {}
+constexpr Cord::InlineRep::InlineRep(absl::string_view sv, CordRep* rep)
+ : data_(sv, rep) {}
inline Cord::InlineRep::InlineRep(const Cord::InlineRep& src)
: data_(InlineData::kDefaultInit) {
@@ -1267,13 +1267,12 @@ inline Cord::Cord(absl::string_view src)
template <typename T>
constexpr Cord::Cord(strings_internal::StringConstant<T>)
- : contents_(strings_internal::StringConstant<T>::value.size() <=
+ : contents_(strings_internal::StringConstant<T>::value,
+ strings_internal::StringConstant<T>::value.size() <=
cord_internal::kMaxInline
- ? cord_internal::InlineData(
- strings_internal::StringConstant<T>::value)
- : cord_internal::InlineData(
- &cord_internal::ConstInitExternalStorage<
- strings_internal::StringConstant<T>>::value)) {}
+ ? nullptr
+ : &cord_internal::ConstInitExternalStorage<
+ strings_internal::StringConstant<T>>::value) {}
inline Cord& Cord::operator=(const Cord& x) {
contents_ = x.contents_;