about summary refs log tree commit diff
path: root/src/libutil/serialise.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-04T15·49+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-04T15·49+0100
commit42bc395b63260e13f42e4bf348823799e78e445f (patch)
tree282cad864de6752d4ef4a02d8c6dc92cfece223f /src/libutil/serialise.hh
parentce113c32d27a24552a6420ea0c082c6886708759 (diff)
Eliminate some large string copying
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r--src/libutil/serialise.hh4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index 0fdc4037b2d7..9ba6391f817a 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -110,7 +110,9 @@ private:
 /* A sink that writes data to a string. */
 struct StringSink : Sink
 {
-    string s;
+    ref<std::string> s;
+    StringSink() : s(make_ref<std::string>()) { };
+    StringSink(ref<std::string> s) : s(s) { };
     void operator () (const unsigned char * data, size_t len) override;
 };