aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/gc-alloc.hh
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-07-15 18:19:54 -0600
committerQyriad <qyriad@qyriad.me>2024-07-20 20:20:01 +0000
commite67dac1d7493741cf88b411f68e31fc496179bf2 (patch)
tree940ec66fad8d250db1eea154265b5765efa13657 /src/libexpr/gc-alloc.hh
parenta3361557e3f4a53b90ca5067e68ba9788df20928 (diff)
libexpr: rename confusing makeImmutableString -> gcCopyStringIfNeeded
The purpose of this function has little to do with immutability. Value's strings are never mutated, and the point of this function is to singleton empty strings. Change-Id: Ifd41dd952409d54e4d3de9ab59064e6928b0e480
Diffstat (limited to 'src/libexpr/gc-alloc.hh')
-rw-r--r--src/libexpr/gc-alloc.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libexpr/gc-alloc.hh b/src/libexpr/gc-alloc.hh
index a16bc65e4..f691bfc4b 100644
--- a/src/libexpr/gc-alloc.hh
+++ b/src/libexpr/gc-alloc.hh
@@ -7,6 +7,7 @@
#include <list>
#include <map>
#include <new>
+#include <string_view>
#include <vector>
#if HAVE_BOEHMGC
@@ -116,4 +117,8 @@ inline char * gcAllocString(size_t size)
return cstr;
}
+/// Returns a C-string copied from @ref toCopyFrom, or a single, static empty
+/// string if @ref toCopyFrom is also empty.
+char const * gcCopyStringIfNeeded(std::string_view toCopyFrom);
+
}