From 03b476f9432bd0f8a4df05ba463044f41fcdfb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Thu, 6 Jun 2024 17:53:13 -0700 Subject: [PATCH] Minor small-string errata from #1199 These commits were sitting on a local branch that I neglected to push before merging. :( * Use memcpy for string::reserve * Remove fence comments --- ctl/string.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ctl/string.cc b/ctl/string.cc index d7a692158..ff864c306 100644 --- a/ctl/string.cc +++ b/ctl/string.cc @@ -99,7 +99,7 @@ string::reserve(size_t c2) noexcept if (!isbig()) { if (!(p2 = (char*)malloc(c2))) __builtin_trap(); - __builtin_memcpy(p2, data(), size() + 1); + memcpy(p2, data(), size() + 1); } else { if (!(p2 = (char*)realloc(big()->p, c2))) __builtin_trap(); @@ -139,7 +139,6 @@ string::append(char ch) noexcept __builtin_trap(); reserve(c2); } - // XXX do we care to fence this? data()[size()] = ch; data()[size() + 1] = 0; if (isbig()) { @@ -174,7 +173,6 @@ string::append(char ch, size_t size) noexcept grow(size); if (size) memset(data() + this->size(), ch, size); - // XXX fence? if (isbig()) { big()->n += size; } else {