about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/hash.cc2
-rw-r--r--src/libutil/util.hh51
2 files changed, 1 insertions, 52 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index 49e781980f3a..81aced0fde16 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -106,7 +106,7 @@ Hash parseHash(HashType ht, const string & s)
         string s2(s, i * 2, 2);
         if (!isxdigit(s2[0]) || !isxdigit(s2[1]))
             throw BadHash(format("invalid hash ‘%1%’") % s);
-        istringstream_nocopy str(s2);
+        std::istringstream str(s2);
         int n;
         str >> std::hex >> n;
         hash.hash[i] = n;
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 1ede48a65ff2..50b96f7ed92c 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -431,55 +431,4 @@ void callSuccess(
 }
 
 
-/* A variant of std::istringstream that doesn't copy its string
-   argument. This is useful for large strings. The caller must ensure
-   that the string object is not destroyed while it's referenced by
-   this object. */
-class istringbuf_nocopy : public std::streambuf
-{
-    const std::string & s;
-    decltype(s.size()) off;
-    decltype(s.size()) size;
-public:
-    istringbuf_nocopy(const std::string & s) : s{s}, off{0}, size{s.size()}
-    {
-    }
-
-private:
-    int_type underflow()
-    {
-      if (off == size)
-          return traits_type::eof();
-      return traits_type::to_int_type(s[off]);
-    }
-
-    int_type uflow()
-    {
-        if (off == size)
-            return traits_type::eof();
-        return traits_type::to_int_type(s[off++]);
-    }
-
-    int_type pbackfail(int_type ch)
-    {
-        if (off == 0 || (ch != traits_type::eof() && ch != s[off - 1]))
-            return traits_type::eof();
-
-        return traits_type::to_int_type(s[--off]);
-    }
-
-    std::streamsize showmanyc()
-    {
-        return size - off;
-    }
-};
-
-
-struct istringstream_nocopy : public std::iostream
-{
-    istringbuf_nocopy buf;
-    istringstream_nocopy(const std::string & s) : std::iostream(&buf), buf(s) {};
-};
-
-
 }