changeset 24177:89167cc74260

Reuse constructor code of delimited stream. * oct-stream.cc (delimited_stream::delimited_stream): Call the first constructor directly from the second constructor rather than replicate code.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Wed, 27 Sep 2017 11:01:06 -0500
parents d2ef665c7c91
children 857b553177a5
files libinterp/corefcn/oct-stream.cc
diffstat 1 files changed, 2 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc	Wed Oct 25 21:04:20 2017 -0700
+++ b/libinterp/corefcn/oct-stream.cc	Wed Sep 27 11:01:06 2017 -0500
@@ -1377,19 +1377,10 @@
   }
 
   // Used to create a stream from a strstream from data read from a dstr.
-  // FIXME: Find a more efficient approach.  Perhaps derived dstr
   delimited_stream::delimited_stream (std::istream& is,
                                       const delimited_stream& ds)
-    : bufsize (ds.bufsize), i_stream (is), longest (ds.longest),
-      delims (ds.delims),
-      flags (std::ios::failbit & ~std::ios::failbit) // can't cast 0
-  {
-    buf = new char[bufsize];
-    eob = buf + bufsize;
-    idx = eob;                    // refresh_buf shouldn't try to copy old data
-    progress_marker = idx;
-    refresh_buf ();               // load the first batch of data
-  }
+    : delimited_stream (is, ds.delims, ds.longest, ds.bufsize)
+  {}
 
   delimited_stream::~delimited_stream (void)
   {