changeset 20898:8da80da1ac37

maint: Use ovl() more places in the code.
author Rik <rik@octave.org>
date Mon, 14 Dec 2015 17:53:27 -0800
parents 9aad16a799c9
children 59d49077825f
files libinterp/corefcn/det.cc libinterp/corefcn/dirfns.cc libinterp/corefcn/file-io.cc libinterp/corefcn/inv.cc libinterp/corefcn/lsode.cc libinterp/corefcn/lu.cc libinterp/corefcn/octave-link.cc libinterp/corefcn/profiler.cc libinterp/corefcn/quadcc.cc libinterp/corefcn/schur.cc libinterp/corefcn/syscalls.cc libinterp/dldfcn/amd.cc libinterp/dldfcn/ccolamd.cc libinterp/dldfcn/chol.cc libinterp/dldfcn/colamd.cc libinterp/dldfcn/convhulln.cc libinterp/dldfcn/qr.cc libinterp/dldfcn/symbfact.cc
diffstat 18 files changed, 359 insertions(+), 496 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/det.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/det.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -145,8 +145,7 @@
         {
           octave_idx_type info;
           float rcond = 0.0;
-          // Always compute rcond, so we can detect numerically
-          // singular matrices.
+          // Always compute rcond, so we can detect singular matrices.
           FloatMatrix m = arg.float_matrix_value ();
 
           MAYBE_CAST (rep, octave_float_matrix);
@@ -161,8 +160,7 @@
         {
           octave_idx_type info;
           float rcond = 0.0;
-          // Always compute rcond, so we can detect numerically
-          // singular matrices.
+          // Always compute rcond, so we can detect singular matrices.
           FloatComplexMatrix m = arg.float_complex_matrix_value ();
 
           MAYBE_CAST (rep, octave_float_complex_matrix);
@@ -180,8 +178,7 @@
         {
           octave_idx_type info;
           double rcond = 0.0;
-          // Always compute rcond, so we can detect numerically
-          // singular matrices.
+          // Always compute rcond, so we can detect singular matrices.
           if (arg.is_sparse_type ())
             {
               SparseMatrix m = arg.sparse_matrix_value ();
@@ -208,8 +205,7 @@
         {
           octave_idx_type info;
           double rcond = 0.0;
-          // Always compute rcond, so we can detect numerically
-          // singular matrices.
+          // Always compute rcond, so we can detect singular matrices.
           if (arg.is_sparse_type ())
             {
               SparseComplexMatrix m = arg.sparse_complex_matrix_value ();
--- a/libinterp/corefcn/dirfns.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/dirfns.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -177,24 +177,20 @@
 @seealso{ls, dir, glob, what}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   if (args.length () != 1)
     print_usage ();
 
-  retval(2) = std::string ();
-  retval(1) = -1.0;
-  retval(0) = Cell ();
+  std::string dirname = args(0).xstring_value ("readdir: DIR must be a string");
 
-  std::string dirname = args(0).xstring_value ("readdir: DIR must be a string");
+  octave_value_list retval = ovl (Cell (), -1.0, "");
 
   dir_entry dir (dirname);
 
   if (dir)
     {
       string_vector dirlist = dir.read ();
+      retval(0) = Cell (dirlist.sort ());
       retval(1) = 0.0;
-      retval(0) = Cell (dirlist.sort ());
     }
   else
     retval(2) = dir.error ();
@@ -225,17 +221,11 @@
 @seealso{rmdir, pwd, cd, umask}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   int nargin = args.length ();
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
 
-  retval(2) = std::string ();
-  retval(1) = std::string ();
-  retval(0) = false;
-
   std::string dirname;
 
   if (nargin == 2)
@@ -248,35 +238,26 @@
   else if (nargin == 1)
     dirname = args(0).xstring_value ("mkdir: DIR must be a string");
 
-  std::string msg;
-
   dirname = file_ops::tilde_expand (dirname);
 
   file_stat fs (dirname);
 
   if (fs && fs.is_dir ())
     {
-      // For compatibility with Matlab, we return true when the
-      // directory already exists.
-
-      retval(2) = "mkdir";
-      retval(1) = "directory exists";
-      retval(0) = true;
+      // For Matlab compatibility, return true when directory already exists.
+      return ovl (true, "directory exists", "mkdir");
     }
   else
     {
+      std::string msg;
+
       int status = octave_mkdir (dirname, 0777, msg);
 
       if (status < 0)
-        {
-          retval(2) = "mkdir";
-          retval(1) = msg;
-        }
+        return ovl (false, msg, "mkdir");
       else
-        retval(0) = true;
+        return ovl (true, "", "");
     }
-
-  return retval;
 }
 
 DEFUNX ("rmdir", Frmdir, args, ,
@@ -297,17 +278,11 @@
 @seealso{mkdir, confirm_recursive_rmdir, pwd}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   int nargin = args.length ();
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
 
-  retval(2) = std::string ();
-  retval(1) = std::string ();
-  retval(0) = false;
-
   std::string dirname = args(0).xstring_value ("rmdir: DIR must be a string");
 
   std::string fulldir = file_ops::tilde_expand (dirname);
@@ -316,37 +291,28 @@
 
   if (nargin == 2)
     {
-      if (args(1).string_value () == "s")
-        {
-          bool doit = true;
+      if (args(1).string_value () != "s")
+        error ("rmdir: second argument must be \"s\" for recursive removal");
+
+      bool doit = true;
 
-          if (interactive && ! forced_interactive
-              && Vconfirm_recursive_rmdir)
-            {
-              std::string prompt
-                = "remove entire contents of " + fulldir + "? ";
+      if (interactive && ! forced_interactive && Vconfirm_recursive_rmdir)
+        {
+          std::string prompt = "remove entire contents of " + fulldir + "? ";
 
-              doit = octave_yes_or_no (prompt);
-            }
+          doit = octave_yes_or_no (prompt);
+        }
 
-          if (doit)
-            status = octave_recursive_rmdir (fulldir, msg);
-        }
-      else
-        error ("rmdir: second argument must be \"s\" for recursive removal");
+      if (doit)
+        status = octave_recursive_rmdir (fulldir, msg);
     }
   else
     status = octave_rmdir (fulldir, msg);
 
   if (status < 0)
-    {
-      retval(2) = "rmdir";
-      retval(1) = msg;
-    }
+    return ovl (false, msg, "rmdir");
   else
-    retval(0) = true;
-
-  return retval;
+    return ovl (true, "", "");
 }
 
 DEFUNX ("link", Flink, args, ,
@@ -361,14 +327,9 @@
 @seealso{symlink, unlink, readlink, lstat}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   if (args.length () != 2)
     print_usage ();
 
-  retval(1) = std::string ();
-  retval(0) = -1.0;
-
   std::string from = args(0).xstring_value ("link: OLD must be a string");
   std::string to = args(1).xstring_value ("link: NEW must be a string");
 
@@ -377,11 +338,9 @@
   int status = octave_link (from, to, msg);
 
   if (status < 0)
-    retval(1) = msg;
-
-  retval(0) = status;
-
-  return retval;
+    return ovl (-1.0, msg);
+  else
+    return ovl (status, "");
 }
 
 DEFUNX ("symlink", Fsymlink, args, ,
@@ -396,14 +355,9 @@
 @seealso{link, unlink, readlink, lstat}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   if (args.length () != 2)
     print_usage ();
 
-  retval(1) = std::string ();
-  retval(0) = -1.0;
-
   std::string from = args(0).xstring_value ("symlink: OLD must be a string");
   std::string to = args(1).xstring_value ("symlink: NEW must be a string");
 
@@ -412,11 +366,9 @@
   int status = octave_symlink (from, to, msg);
 
   if (status < 0)
-    retval(1) = msg;
-
-  retval(0) = status;
-
-  return retval;
+    return ovl (-1.0, msg);
+  else
+    return ovl (status, "");
 }
 
 DEFUNX ("readlink", Freadlink, args, ,
@@ -432,29 +384,19 @@
 @seealso{lstat, symlink, link, unlink, delete}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   if (args.length () != 1)
     print_usage ();
 
-  retval(2) = std::string ();
-  retval(1) = -1.0;
-  retval(0) = std::string ();
-
   std::string symlink = args(0).xstring_value ("readlink: SYMLINK must be a string");
 
-  std::string result;
-  std::string msg;
+  std::string result, msg;
 
   int status = octave_readlink (symlink, result, msg);
 
   if (status < 0)
-    retval(2) = msg;
-
-  retval(1) = status;
-  retval(0) = result;
-
-  return retval;
+    return ovl ("", -1.0, msg);
+  else
+    return ovl (result, status, "");
 }
 
 DEFUNX ("rename", Frename, args, ,
@@ -469,14 +411,9 @@
 @seealso{movefile, copyfile, ls, dir}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   if (args.length () != 2)
     print_usage ();
 
-  retval(1) = std::string ();
-  retval(0) = -1.0;
-
   std::string from = args(0).xstring_value ("rename: OLD must be a string");
   std::string to = args(1).xstring_value ("rename: NEW must be a string");
 
@@ -485,11 +422,9 @@
   int status = octave_rename (from, to, msg);
 
   if (status < 0)
-    retval(1) = msg;
-
-  retval(0) = status;
-
-  return retval;
+    return ovl (-1.0, msg);
+  else
+    return ovl (status, "");
 }
 
 DEFUN (glob, args, ,
--- a/libinterp/corefcn/file-io.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/file-io.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -975,50 +975,43 @@
 {
   static std::string who = "sprintf";
 
-  octave_value_list retval;
-
   int nargin = args.length ();
 
   if (nargin == 0)
     print_usage ();
 
-  retval = ovl ("", "unknown error", -1.0);
-
   octave_ostrstream *ostr = new octave_ostrstream ();
 
   octave_stream os (ostr);
 
-  if (os.is_valid ())
-    {
-      octave_value fmt_arg = args(0);
+  if (! os.is_valid ())
+    error ("%s: unable to create output buffer", who.c_str ());
 
-      if (fmt_arg.is_string ())
-        {
-          octave_value_list tmp_args;
+  octave_value fmt_arg = args(0);
 
-          if (nargin > 1)
-            {
-              tmp_args.resize (nargin-1, octave_value ());
+  if (! fmt_arg.is_string ())
+    error ("%s: format TEMPLATE must be a string", who.c_str ());
 
-              for (int i = 1; i < nargin; i++)
-                tmp_args(i-1) = args(i);
-            }
+  octave_value_list retval (3);
 
-          retval(2) = os.printf (fmt_arg, tmp_args, who);
-          retval(1) = os.error ();
+  octave_value_list tmp_args;
+  if (nargin > 1)
+    {
+      tmp_args.resize (nargin-1, octave_value ());
 
-          std::string result = ostr->str ();
-          char type = fmt_arg.is_sq_string () ? '\'' : '"';
+      for (int i = 1; i < nargin; i++)
+        tmp_args(i-1) = args(i);
+    }
 
-          retval(0) = (result.empty ()
-                       ? octave_value (charMatrix (1, 0), type)
-                       : octave_value (result, type));
-        }
-      else
-        error ("%s: format TEMPLATE must be a string", who.c_str ());
-    }
-  else
-    error ("%s: unable to create output buffer", who.c_str ());
+  // NOTE: Call to os.error must precede next call to ostr which might reset it.
+  retval(2) = os.printf (fmt_arg, tmp_args, who);
+  retval(1) = os.error ();
+
+  std::string result = ostr->str ();
+  char type = fmt_arg.is_sq_string () ? '\'' : '"';
+
+  retval(0) = (result.empty () ? octave_value (charMatrix (1, 0), type)
+                               : octave_value (result, type));
 
   return retval;
 }
--- a/libinterp/corefcn/inv.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/inv.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -61,8 +61,6 @@
   if (args.length () != 1)
     print_usage ();
 
-  octave_value_list retval;
-
   octave_value arg = args(0);
 
   octave_idx_type nr = arg.rows ();
@@ -71,14 +69,14 @@
   int arg_is_empty = empty_arg ("inverse", nr, nc);
 
   if (arg_is_empty < 0)
-    return retval;
+    return octave_value_list ();
   else if (arg_is_empty > 0)
     return octave_value (Matrix ());
 
   if (nr != nc)
     {
       gripe_square_matrix_required ("inverse");
-      return retval;
+      return octave_value_list ();
     }
 
   octave_value result;
@@ -191,11 +189,12 @@
         gripe_wrong_type_arg ("inv", arg);
     }
 
+  octave_value_list retval (nargout > 1 ? 2 : 1);
+
+  retval(0) = result;
   if (nargout > 1)
     retval(1) = isfloat ? octave_value (frcond) : octave_value (rcond);
 
-  retval(0) = result;
-
   bool rcond_plus_one_eq_one = false;
 
   if (isfloat)
--- a/libinterp/corefcn/lsode.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/lsode.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -261,7 +261,10 @@
 @seealso{daspk, dassl, dasrt}\n\
 @end deftypefn")
 {
-  octave_value_list retval (3);
+  int nargin = args.length ();
+
+  if (nargin < 3 || nargin > 4 || nargout > 3)
+    print_usage ();
 
   warned_fcn_imaginary = false;
   warned_jac_imaginary = false;
@@ -274,11 +277,6 @@
   if (call_depth > 1)
     error ("lsode: invalid recursive call");
 
-  int nargin = args.length ();
-
-  if (nargin < 3 || nargin > 4 || nargout > 3)
-    print_usage ();
-
   std::string fcn_name, fname, jac_name, jname;
   lsode_fcn = 0;
   lsode_jac = 0;
@@ -427,6 +425,8 @@
 
   std::string msg = ode.error_message ();
 
+  octave_value_list retval (3);
+
   if (ode.integration_ok ())
     retval(0) = output;
   else if (nargout < 2)
--- a/libinterp/corefcn/lu.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/lu.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -636,7 +636,6 @@
   if (! check_lu_dims (argl, argu, argp))
     error ("luupdate: dimension mismatch");
 
-  octave_value_list retval;
   PermMatrix P = (pivoted
                   ? argp.perm_matrix_value ()
                   : PermMatrix::eye (argl.rows ()));
@@ -660,9 +659,9 @@
             fact.update (x, y);
 
           if (pivoted)
-            retval(2) = fact.P ();
-          retval(1) = get_lu_u (fact);
-          retval(0) = get_lu_l (fact);
+            return ovl (get_lu_l (fact), get_lu_u (fact), fact.P ());
+          else
+            return ovl (get_lu_l (fact), get_lu_u (fact));
         }
       else
         {
@@ -678,9 +677,9 @@
             fact.update (x, y);
 
           if (pivoted)
-            retval(2) = fact.P ();
-          retval(1) = get_lu_u (fact);
-          retval(0) = get_lu_l (fact);
+            return ovl (get_lu_l (fact), get_lu_u (fact), fact.P ());
+          else
+            return ovl (get_lu_l (fact), get_lu_u (fact));
         }
     }
   else
@@ -701,9 +700,9 @@
             fact.update (x, y);
 
           if (pivoted)
-            retval(2) = fact.P ();
-          retval(1) = get_lu_u (fact);
-          retval(0) = get_lu_l (fact);
+            return ovl (get_lu_l (fact), get_lu_u (fact), fact.P ());
+          else
+            return ovl (get_lu_l (fact), get_lu_u (fact));
         }
       else
         {
@@ -719,13 +718,11 @@
             fact.update (x, y);
 
           if (pivoted)
-            retval(2) = fact.P ();
-          retval(1) = get_lu_u (fact);
-          retval(0) = get_lu_l (fact);
+            return ovl (get_lu_l (fact), get_lu_u (fact), fact.P ());
+          else
+            return ovl (get_lu_l (fact), get_lu_u (fact));
         }
     }
-
-  return retval;
 }
 
 /*
--- a/libinterp/corefcn/octave-link.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/octave-link.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -194,68 +194,65 @@
 Undocumented internal function.\n\
 @end deftypefn")
 {
-  octave_value_list retval;
+  if (args.length () != 6)
+    return octave_value_list ();
 
-  if (args.length () == 6)
-    {
+  octave_value_list retval (3);
 
-      const Array<std::string> flist = args(0).cellstr_value ();
-      std::string title = args(1).string_value ();
-      std::string filename = args(2).string_value ();
-      Matrix pos = args(3).matrix_value ();
-      std::string multi_on = args(4).string_value (); // on, off, create
-      std::string pathname = args(5).string_value ();
-
-      octave_idx_type nel;
-      octave_link::filter_list filter_lst;
+  const Array<std::string> flist = args(0).cellstr_value ();
+  std::string title = args(1).string_value ();
+  std::string filename = args(2).string_value ();
+  Matrix pos = args(3).matrix_value ();
+  std::string multi_on = args(4).string_value (); // on, off, create
+  std::string pathname = args(5).string_value ();
 
-      for (octave_idx_type i = 0; i < flist.rows (); i++)
-        filter_lst.push_back (std::make_pair (flist(i,0),
-                                              (flist.columns () > 1
-                                               ? flist(i,1) : "")));
+  octave_idx_type nel;
+  octave_link::filter_list filter_lst;
 
-      flush_octave_stdout ();
+  for (octave_idx_type i = 0; i < flist.rows (); i++)
+    filter_lst.push_back (std::make_pair (flist(i,0),
+                                          (flist.columns () > 1
+                                           ? flist(i,1) : "")));
 
-      std::list<std::string> items_lst
-        = octave_link::file_dialog (filter_lst, title, filename, pathname,
-                                    multi_on);
+  flush_octave_stdout ();
 
-      nel = items_lst.size ();
+  std::list<std::string> items_lst
+    = octave_link::file_dialog (filter_lst, title, filename, pathname,
+                                multi_on);
 
-      retval.resize (3);
+  nel = items_lst.size ();
 
-      // If 3, then retval is filename, directory, and selected index.
-      if (nel <= 3)
+  // If 3, then retval is filename, directory, and selected index.
+  if (nel <= 3)
+    {
+      int idx = 0;
+      for (std::list<std::string>::iterator it = items_lst.begin ();
+           it != items_lst.end (); it++)
         {
-          int idx = 0;
-          for (std::list<std::string>::iterator it = items_lst.begin ();
-               it != items_lst.end (); it++)
-            {
-              retval(idx++) = *it;
+          retval(idx++) = *it;
 
-              if (idx == 1 && retval(0).string_value ().length () == 0)
-                retval(0) = 0;
+          if (idx == 1 && retval(0).string_value ().length () == 0)
+            retval(0) = 0;
 
-              if (idx == 3)
-                retval(2) = atoi (retval(2).string_value ().c_str ());
-            }
+          if (idx == 3)
+            retval(2) = atoi (retval(2).string_value ().c_str ());
         }
-      else
-        {
-          // Multiple files.
-          nel = items_lst.size () - 2;
-          Cell items (dim_vector (1, nel));
-
-          std::list<std::string>::iterator it = items_lst.begin ();
+    }
+  else
+    {
+      // Multiple files.
+      nel = items_lst.size () - 2;
+      Cell items (dim_vector (1, nel));
 
-          for (int idx = 0; idx < nel; idx++)
-            {
-              items.xelem (idx) = *it;
-              it++;
-            }
+      std::list<std::string>::iterator it = items_lst.begin ();
 
-          retval = ovl (items, *it++, atoi (it->c_str ()));
+      for (int idx = 0; idx < nel; idx++)
+        {
+          items.xelem (idx) = *it;
+          it++;
         }
+
+      retval = ovl (items, *it++, atoi (it->c_str ()));
     }
 
   return retval;
@@ -267,60 +264,56 @@
 Undocumented internal function.\n\
 @end deftypefn")
 {
-  octave_value_list retval;
+  if (args.length () != 8)
+    return octave_value_list ();
 
-  if (args.length () == 8)
-    {
-      Cell list = args(0).cell_value ();
-      const Array<std::string> tlist = list.cellstr_value ();
-      octave_idx_type nel = tlist.numel ();
-      std::list<std::string> list_lst;
-      for (octave_idx_type i = 0; i < nel; i++)
-        list_lst.push_back (tlist(i));
+  Cell list = args(0).cell_value ();
+  const Array<std::string> tlist = list.cellstr_value ();
+  octave_idx_type nel = tlist.numel ();
+  std::list<std::string> list_lst;
+  for (octave_idx_type i = 0; i < nel; i++)
+    list_lst.push_back (tlist(i));
 
-      std::string mode = args(1).string_value ();
+  std::string mode = args(1).string_value ();
 
-      Matrix size_matrix = args(2).matrix_value ();
-      int width = size_matrix(0);
-      int height = size_matrix(1);
+  Matrix size_matrix = args(2).matrix_value ();
+  int width = size_matrix(0);
+  int height = size_matrix(1);
 
-      Matrix initial_matrix = args(3).matrix_value ();
-      nel = initial_matrix.numel ();
-      std::list<int> initial_lst;
-      for (octave_idx_type i = 0; i < nel; i++)
-        initial_lst.push_back (initial_matrix(i));
+  Matrix initial_matrix = args(3).matrix_value ();
+  nel = initial_matrix.numel ();
+  std::list<int> initial_lst;
+  for (octave_idx_type i = 0; i < nel; i++)
+    initial_lst.push_back (initial_matrix(i));
 
-      std::string name = args(4).string_value ();
-      list = args(5).cell_value ();
-      const Array<std::string> plist = list.cellstr_value ();
-      nel = plist.numel ();
-      std::list<std::string> prompt_lst;
-      for (octave_idx_type i = 0; i < nel; i++)
-        prompt_lst.push_back (plist(i));
-      std::string ok_string = args(6).string_value ();
-      std::string cancel_string = args(7).string_value ();
+  std::string name = args(4).string_value ();
+  list = args(5).cell_value ();
+  const Array<std::string> plist = list.cellstr_value ();
+  nel = plist.numel ();
+  std::list<std::string> prompt_lst;
+  for (octave_idx_type i = 0; i < nel; i++)
+    prompt_lst.push_back (plist(i));
+  std::string ok_string = args(6).string_value ();
+  std::string cancel_string = args(7).string_value ();
 
-      flush_octave_stdout ();
+  flush_octave_stdout ();
 
-      std::pair<std::list<int>, int> result
-        = octave_link::list_dialog (list_lst, mode, width, height,
-                                    initial_lst, name, prompt_lst,
-                                    ok_string, cancel_string);
+  std::pair<std::list<int>, int> result
+    = octave_link::list_dialog (list_lst, mode, width, height,
+                                initial_lst, name, prompt_lst,
+                                ok_string, cancel_string);
 
-      std::list<int> items_lst = result.first;
-      nel = items_lst.size ();
-      Matrix items (dim_vector (1, nel));
-      octave_idx_type i = 0;
-      for (std::list<int>::iterator it = items_lst.begin ();
-           it != items_lst.end (); it++)
-        {
-          items.xelem(i++) = *it;
-        }
-
-      retval = ovl (items, result.second);
+  std::list<int> items_lst = result.first;
+  nel = items_lst.size ();
+  Matrix items (dim_vector (1, nel));
+  octave_idx_type i = 0;
+  for (std::list<int>::iterator it = items_lst.begin ();
+       it != items_lst.end (); it++)
+    {
+      items.xelem(i++) = *it;
     }
 
-  return retval;
+  return ovl (items, result.second);
 }
 
 DEFUN (__octave_link_input_dialog__, args, ,
@@ -329,55 +322,51 @@
 Undocumented internal function.\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  if (args.length () == 4)
-    {
-      Cell prompt = args(0).cell_value ();
-      Array<std::string> tmp = prompt.cellstr_value ();
-      octave_idx_type nel = tmp.numel ();
-      std::list<std::string> prompt_lst;
-      for (octave_idx_type i = 0; i < nel; i++)
-        prompt_lst.push_back (tmp(i));
+  if (args.length () != 4)
+    return octave_value_list ();
 
-      std::string title = args(1).string_value ();
-
-      Matrix rc = args(2).matrix_value ();
-      nel = rc.rows ();
-      std::list<float> nr;
-      std::list<float> nc;
-      for (octave_idx_type i = 0; i < nel; i++)
-        {
-          nr.push_back (rc(i,0));
-          nc.push_back (rc(i,1));
-        }
+  Cell prompt = args(0).cell_value ();
+  Array<std::string> tmp = prompt.cellstr_value ();
+  octave_idx_type nel = tmp.numel ();
+  std::list<std::string> prompt_lst;
+  for (octave_idx_type i = 0; i < nel; i++)
+    prompt_lst.push_back (tmp(i));
 
-      Cell defaults = args(3).cell_value ();
-      tmp = defaults.cellstr_value ();
-      nel = tmp.numel ();
-      std::list<std::string> defaults_lst;
-      for (octave_idx_type i = 0; i < nel; i++)
-        defaults_lst.push_back (tmp(i));
-
-      flush_octave_stdout ();
+  std::string title = args(1).string_value ();
 
-      std::list<std::string> items_lst
-        = octave_link::input_dialog (prompt_lst, title, nr, nc,
-                                     defaults_lst);
-
-      nel = items_lst.size ();
-      Cell items (dim_vector (nel, 1));
-      octave_idx_type i = 0;
-      for (std::list<std::string>::iterator it = items_lst.begin ();
-           it != items_lst.end (); it++)
-        {
-          items.xelem(i++) = *it;
-        }
-
-      retval = items;
+  Matrix rc = args(2).matrix_value ();
+  nel = rc.rows ();
+  std::list<float> nr;
+  std::list<float> nc;
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      nr.push_back (rc(i,0));
+      nc.push_back (rc(i,1));
     }
 
-  return retval;
+  Cell defaults = args(3).cell_value ();
+  tmp = defaults.cellstr_value ();
+  nel = tmp.numel ();
+  std::list<std::string> defaults_lst;
+  for (octave_idx_type i = 0; i < nel; i++)
+    defaults_lst.push_back (tmp(i));
+
+  flush_octave_stdout ();
+
+  std::list<std::string> items_lst
+    = octave_link::input_dialog (prompt_lst, title, nr, nc,
+                                 defaults_lst);
+
+  nel = items_lst.size ();
+  Cell items (dim_vector (nel, 1));
+  octave_idx_type i = 0;
+  for (std::list<std::string>::iterator it = items_lst.begin ();
+       it != items_lst.end (); it++)
+    {
+      items.xelem(i++) = *it;
+    }
+
+  return ovl (items);
 }
 
 DEFUN (__octave_link_show_preferences__, , ,
@@ -386,11 +375,7 @@
 Undocumented internal function.\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  retval = octave_link::show_preferences ();
-
-  return retval;
+  return octave_value (octave_link::show_preferences ());
 }
 
 DEFUN (__octave_link_show_doc__, args, ,
@@ -399,16 +384,11 @@
 Undocumented internal function.\n\
 @end deftypefn")
 {
-  octave_value retval;
   std::string file;
 
   if (args.length () >= 1)
     file = args(0).string_value();
 
-  retval = octave_link::show_doc (file);
-
-  return retval;
+  return octave_value (octave_link::show_doc (file));
 }
 
-
-
--- a/libinterp/corefcn/profiler.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/profiler.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -436,12 +436,9 @@
   if (args.length () > 0)
     warning ("profiler_data: ignoring extra arguments");
 
-  octave_value_list retval;
-
   if (nargout > 1)
-    retval(1) = profiler.get_hierarchical ();
-  retval(0) = profiler.get_flat ();
-
-  return retval;
+    return ovl (profiler.get_flat (), profiler.get_hierarchical ());
+  else
+    return ovl (profiler.get_flat ());
 }
 
--- a/libinterp/corefcn/quadcc.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/quadcc.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -1555,8 +1555,6 @@
 @seealso{quad, quadv, quadl, quadgk, trapz, dblquad, triplequad}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   /* Some constants that we will need. */
   static const int n[4] = { 4, 8, 16, 32 };
   static const int skip[4] = { 8, 4, 2, 1 };
@@ -2217,6 +2215,8 @@
 #endif
 
   /* Clean up and present the results. */
+  octave_value_list retval;
+
   if (nargout > 2)
     retval(2) = neval;
   if (nargout > 1)
--- a/libinterp/corefcn/schur.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/schur.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -291,11 +291,11 @@
 @seealso{schur}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   if (args.length () != 2 || nargout > 2)
     print_usage ();
 
+  octave_value_list retval;
+
   if (! args(0).is_numeric_type ())
     gripe_wrong_type_arg ("rsf2csf", args(0));
   else if (! args(1).is_numeric_type ())
@@ -312,8 +312,7 @@
 
           FloatComplexSCHUR cs (FloatSCHUR (t, u));
 
-          retval(1) = cs.schur_matrix ();
-          retval(0) = cs.unitary_matrix ();
+          retval = ovl (cs.unitary_matrix (), cs.schur_matrix ());
         }
       else
         {
@@ -322,8 +321,7 @@
 
           ComplexSCHUR cs (SCHUR (t, u));
 
-          retval(1) = cs.schur_matrix ();
-          retval(0) = cs.unitary_matrix ();
+          retval = ovl (cs.unitary_matrix (), cs.schur_matrix ());
         }
     }
 
--- a/libinterp/corefcn/syscalls.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/corefcn/syscalls.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -685,11 +685,6 @@
   if (octal_mode < 0)
     error ("mkfifo: MODE must be a positive integer value");
 
-  octave_value_list retval (2);
-
-  retval(1) = std::string ();
-  retval(0) = -1;
-
   int mode = convert (octal_mode, 8, 10);
 
   std::string msg;
--- a/libinterp/dldfcn/amd.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/dldfcn/amd.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -84,8 +84,6 @@
 @seealso{symamd, colamd}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
 #ifdef HAVE_AMD
   int nargin = args.length ();
 
@@ -164,35 +162,25 @@
   octave_idx_type result = AMD_NAME (_order) (n_col, cidx, ridx, P,
                                               Control, Info);
 
-  switch (result)
-    {
-    case AMD_OUT_OF_MEMORY:
-      error ("amd: out of memory");
-      break;
-
-    case AMD_INVALID:
-      error ("amd: matrix S is corrupted");
-      break;
+  if (result == AMD_OUT_OF_MEMORY)
+    error ("amd: out of memory");
+  else if (result == AMD_INVALID)
+    error ("amd: matrix S is corrupted");
 
-    default:
-      {
-        if (nargout > 1)
-          retval(1) = xinfo;
+  Matrix Pout (1, n_col);
+  for (octave_idx_type i = 0; i < n_col; i++)
+    Pout.xelem (i) = P[i] + 1;
 
-        Matrix Pout (1, n_col);
-        for (octave_idx_type i = 0; i < n_col; i++)
-          Pout.xelem (i) = P[i] + 1;
+  if (nargout > 1)
+    return ovl (Pout, xinfo);
+  else
+    return ovl (Pout);
 
-        retval(0) = Pout;
-      }
-    }
 #else
 
   error ("amd: not available in this version of Octave");
 
 #endif
-
-  return retval;
 }
 /*
 %!shared A, A2, opts
--- a/libinterp/dldfcn/ccolamd.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/dldfcn/ccolamd.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -143,17 +143,15 @@
 @seealso{colamd, csymamd}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
 #ifdef HAVE_CCOLAMD
 
   int nargin = args.length ();
-  int spumoni = 0;
 
   if (nargout > 2 || nargin < 1 || nargin > 3)
     usage ("ccolamd: incorrect number of input and/or output arguments");
 
-  retval.resize (nargout == 2 ? 2 : 1);
+  octave_value_list retval (nargout == 2 ? 2 : 1);
+  int spumoni = 0;
 
   // Get knobs
   OCTAVE_LOCAL_BUFFER (double, knobs, CCOLAMD_KNOBS);
@@ -329,13 +327,13 @@
       out_stats (CCOLAMD_INFO2) ++ ;
     }
 
+  return retval;
+
 #else
 
   error ("ccolamd: not available in this version of Octave");
 
 #endif
-
-  return retval;
 }
 
 DEFUN_DLD (csymamd, args, nargout,
@@ -403,17 +401,15 @@
 @seealso{symamd, ccolamd}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
 #if HAVE_CCOLAMD
 
   int nargin = args.length ();
-  int spumoni = 0;
 
   if (nargout > 2 || nargin < 1 || nargin > 3)
     usage ("ccolamd: incorrect number of input and/or output arguments");
 
-  retval.resize (nargout == 2 ? 2 : 1);
+  octave_value_list retval (nargout == 2 ? 2 : 1);
+  int spumoni = 0;
 
   // Get knobs
   OCTAVE_LOCAL_BUFFER (double, knobs, CCOLAMD_KNOBS);
@@ -562,11 +558,11 @@
       out_stats (CCOLAMD_INFO2) ++ ;
     }
 
+  return retval;
+
 #else
 
   error ("csymamd: not available in this version of Octave");
 
 #endif
-
-  return retval;
 }
--- a/libinterp/dldfcn/chol.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/dldfcn/chol.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -147,15 +147,15 @@
 @seealso{hess, lu, qr, qz, schur, svd, ichol, cholinv, chol2inv, cholupdate, cholinsert, choldelete, cholshift}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
   int nargin = args.length ();
-  bool LLt = false;
-  bool vecout = false;
 
   if (nargin < 1 || nargin > 3 || nargout > 3
       || (! args(0).is_sparse_type () && nargout > 2))
     print_usage ();
 
+  bool LLt = false;
+  bool vecout = false;
+
   int n = 1;
   while (n < nargin)
     {
@@ -171,6 +171,7 @@
         error ("chol: optional argument must be one of \"vector\", \"lower\", or \"upper\"");
     }
 
+  octave_value_list retval;
   octave_value arg = args(0);
 
   octave_idx_type nr = arg.rows ();
@@ -179,7 +180,7 @@
   int arg_is_empty = empty_arg ("chol", nr, nc);
 
   if (arg_is_empty < 0)
-    return retval;
+    return octave_value_list ();
   if (arg_is_empty > 0)
     return octave_value (Matrix ());
 
@@ -203,7 +204,7 @@
                 retval(2) = fact.Q ();
             }
 
-          if (nargout > 1 || info == 0)
+          if (nargout >= 2 || info == 0)
             {
               retval(1) = info;
               if (LLt)
@@ -228,7 +229,7 @@
                 retval(2) = fact.Q ();
             }
 
-          if (nargout > 1 || info == 0)
+          if (nargout >= 2 || info == 0)
             {
               retval(1) = info;
               if (LLt)
@@ -570,7 +571,7 @@
 {
   int nargin = args.length ();
 
-  if (nargin > 3 || nargin < 2)
+  if (nargin < 2 || nargin > 3)
     print_usage ();
 
   octave_value argr = args(0);
--- a/libinterp/dldfcn/colamd.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/dldfcn/colamd.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -278,17 +278,14 @@
 @seealso{colperm, symamd, ccolamd}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
 #ifdef HAVE_COLAMD
-
   int nargin = args.length ();
-  int spumoni = 0;
 
   if (nargout > 2 || nargin < 1 || nargin > 2)
     print_usage ();
 
-  retval.resize (nargout == 2 ? 2 : 1);
+  octave_value_list retval (nargout == 2 ? 2 : 1);
+  int spumoni = 0;
 
   // Get knobs
   OCTAVE_LOCAL_BUFFER (double, knobs, COLAMD_KNOBS);
@@ -441,13 +438,13 @@
       out_stats (COLAMD_INFO2) ++ ;
     }
 
+  return retval;
+
 #else
 
   error ("colamd: not available in this version of Octave");
 
 #endif
-
-  return retval;
 }
 
 DEFUN_DLD (symamd, args, nargout,
@@ -515,17 +512,15 @@
 @seealso{colperm, colamd}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
 #ifdef HAVE_COLAMD
 
   int nargin = args.length ();
-  int spumoni = 0;
 
   if (nargout > 2 || nargin < 1 || nargin > 2)
     print_usage ();
 
-  retval.resize (nargin == 2 ? 2 : 1);
+  octave_value_list retval (nargin == 2 ? 2 : 1);
+  int spumoni = 0;
 
   // Get knobs
   OCTAVE_LOCAL_BUFFER (double, knobs, COLAMD_KNOBS);
@@ -633,13 +628,13 @@
       out_stats (COLAMD_INFO2) ++ ;
     }
 
+  return retval;
+
 #else
 
   error ("symamd: not available in this version of Octave");
 
 #endif
-
-  return retval;
 }
 
 DEFUN_DLD (etree, args, nargout,
@@ -660,17 +655,17 @@
 permutations on the tree.\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   int nargin = args.length ();
 
   if (nargout > 2 || nargin < 1 || nargin > 2)
     print_usage ();
 
-  retval.resize (nargout == 2 ? 2 : 1);
+  octave_value_list retval (nargout == 2 ? 2 : 1);
 
-  octave_idx_type n_row = 0, n_col = 0;
-  octave_idx_type *ridx = 0, *cidx = 0;
+  octave_idx_type n_row = 0;
+  octave_idx_type n_col = 0;
+  octave_idx_type *ridx = 0;
+  octave_idx_type *cidx = 0;
 
   if (args(0).is_sparse_type ())
     {
--- a/libinterp/dldfcn/convhulln.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/dldfcn/convhulln.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -104,14 +104,15 @@
 @seealso{convhull, delaunayn, voronoin}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
 #if defined (HAVE_QHULL)
 
   int nargin = args.length ();
+
   if (nargin < 1 || nargin > 2)
     print_usage ();
 
+  octave_value_list retval;
+
   Matrix points (args(0).matrix_value ());
   const octave_idx_type dim = points.columns ();
   const octave_idx_type num_points = points.rows ();
@@ -159,11 +160,11 @@
 #endif
   FILE *errfile = stderr;
 
-  if (outfile)
-    frame.add_fcn (close_fcn, outfile);
-  else
+  if (! outfile)
     error ("convhulln: unable to create temporary file for output");
 
+  frame.add_fcn (close_fcn, outfile);
+
   // qh_new_qhull command and points arguments are not const...
 
   std::string cmd = "qhull" + options;
@@ -174,108 +175,106 @@
 
   int exitcode = qh_new_qhull (dim, num_points, points.fortran_vec (),
                                ismalloc, cmd_str, outfile, errfile);
-  if (! exitcode)
-    {
-      bool nonsimp_seen = false;
+  if (exitcode)
+    error ("convhulln: qhull failed");
 
-      octave_idx_type nf = qh num_facets;
+  bool nonsimp_seen = false;
+
+  octave_idx_type nf = qh num_facets;
+
+  Matrix idx (nf, dim + 1);
 
-      Matrix idx (nf, dim + 1);
+  facetT *facet;
 
-      facetT *facet;
+  octave_idx_type i = 0;
 
-      octave_idx_type i = 0;
+  FORALLfacets
+    {
+      octave_idx_type j = 0;
 
-      FORALLfacets
+      if (! (nonsimp_seen || facet->simplicial || qh hull_dim == 2))
         {
-          octave_idx_type j = 0;
+          nonsimp_seen = true;
 
-          if (! (nonsimp_seen || facet->simplicial || qh hull_dim == 2))
-            {
-              nonsimp_seen = true;
+          if (cmd.find ("QJ") != std::string::npos)
+            // Should never happen with QJ.
+            error ("convhulln: qhull failed: option 'QJ' returned non-simplicial facet");
+        }
+
+      if (dim == 3)
+        {
+          setT *vertices = qh_facet3vertex (facet);
 
-              if (cmd.find ("QJ") != std::string::npos)
-                // Should never happen with QJ.
-                error ("convhulln: qhull failed: option 'QJ' returned non-simplicial facet");
-            }
+          vertexT *vertex, **vertexp;
+
+          FOREACHvertex_ (vertices)
+            idx(i, j++) = 1 + qh_pointid(vertex->point);
 
-          if (dim == 3)
+          qh_settempfree (&vertices);
+        }
+      else
+        {
+          if (facet->toporient ^ qh_ORIENTclock)
             {
-              setT *vertices = qh_facet3vertex (facet);
-
               vertexT *vertex, **vertexp;
 
-              FOREACHvertex_ (vertices)
+              FOREACHvertex_ (facet->vertices)
                 idx(i, j++) = 1 + qh_pointid(vertex->point);
-
-              qh_settempfree (&vertices);
             }
           else
             {
-              if (facet->toporient ^ qh_ORIENTclock)
-                {
-                  vertexT *vertex, **vertexp;
+              vertexT *vertex, **vertexp;
+
+              FOREACHvertexreverse12_ (facet->vertices)
+                idx(i, j++) = 1 + qh_pointid(vertex->point);
+            }
+        }
+      if (j < dim)
+        warning ("convhulln: facet %d only has %d vertices", i, j);
+
+      i++;
+    }
+
+  // Remove extra dimension if all facets were simplicial.
+
+  if (! nonsimp_seen)
+    idx.resize (nf, dim, 0.0);
+
+  if (nargout == 2)
+    {
+      // Calculate volume of convex hull, taken from qhull src/geom2.c.
 
-                  FOREACHvertex_ (facet->vertices)
-                    idx(i, j++) = 1 + qh_pointid(vertex->point);
-                }
-              else
-                {
-                  vertexT *vertex, **vertexp;
+      realT area;
+      realT dist;
+
+      FORALLfacets
+        {
+          if (! facet->normal)
+            continue;
+
+          if (facet->upperdelaunay && qh ATinfinity)
+            continue;
 
-                  FOREACHvertexreverse12_ (facet->vertices)
-                    idx(i, j++) = 1 + qh_pointid(vertex->point);
-                }
+          facet->f.area = area = qh_facetarea (facet);
+          facet->isarea = True;
+
+          if (qh DELAUNAY)
+            {
+              if (facet->upperdelaunay == qh UPPERdelaunay)
+                qh totarea += area;
             }
-          if (j < dim)
-            warning ("convhulln: facet %d only has %d vertices", i, j);
-
-          i++;
+          else
+            {
+              qh totarea += area;
+              qh_distplane (qh interior_point, facet, &dist);
+              qh totvol += -dist * area/ qh hull_dim;
+            }
         }
 
-      // Remove extra dimension if all facets were simplicial.
-
-      if (! nonsimp_seen)
-        idx.resize (nf, dim, 0.0);
-
-      if (nargout == 2)
-        {
-          // Calculate volume of convex hull, taken from qhull src/geom2.c.
-
-          realT area;
-          realT dist;
-
-          FORALLfacets
-            {
-              if (! facet->normal)
-                continue;
-
-              if (facet->upperdelaunay && qh ATinfinity)
-                continue;
+      retval(1) = octave_value (qh totvol);
+    }
 
-              facet->f.area = area = qh_facetarea (facet);
-              facet->isarea = True;
-
-              if (qh DELAUNAY)
-                {
-                  if (facet->upperdelaunay == qh UPPERdelaunay)
-                    qh totarea += area;
-                }
-              else
-                {
-                  qh totarea += area;
-                  qh_distplane (qh interior_point, facet, &dist);
-                  qh totvol += -dist * area/ qh hull_dim;
-                }
-            }
-
-          retval(1) = octave_value (qh totvol);
-        }
-
-      retval(0) = idx;
-    }
-  else
-    error ("convhulln: qhull failed");
+  retval(0) = idx;
 
   // Free memory from Qhull
   qh_freeqhull (! qh_ALL);
@@ -287,11 +286,11 @@
     warning ("convhulln: did not free %d bytes of long memory (%d pieces)",
              totlong, curlong);
 
+  return retval;
+
 #else
   error ("convhulln: not available in this version of Octave");
 #endif
-
-  return retval;
 }
 
 /*
--- a/libinterp/dldfcn/qr.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/dldfcn/qr.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -199,13 +199,13 @@
 @seealso{chol, hess, lu, qz, schur, svd, qrupdate, qrinsert, qrdelete, qrshift}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   int nargin = args.length ();
 
   if (nargin < 1 || nargin > (args(0).is_sparse_type () ? 3 : 2))
     print_usage ();
 
+  octave_value_list retval;
+
   octave_value arg = args(0);
 
   int arg_is_empty = empty_arg ("qr", arg.rows (), arg.columns ());
@@ -307,12 +307,11 @@
                 default:
                   {
                     FloatQRP fact (m, type);
+
                     if (type == QR::economy)
-                      retval(2) = fact.Pvec ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.Pvec ());
                     else
-                      retval(2) = fact.P ();
-                    retval(1) = get_qr_r (fact);
-                    retval(0) = fact.Q ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.P ());
                   }
                   break;
                 }
@@ -342,11 +341,9 @@
                   {
                     FloatComplexQRP fact (m, type);
                     if (type == QR::economy)
-                      retval(2) = fact.Pvec ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.Pvec ());
                     else
-                      retval(2) = fact.P ();
-                    retval(1) = get_qr_r (fact);
-                    retval(0) = fact.Q ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.P ());
                   }
                   break;
                 }
@@ -379,11 +376,9 @@
                   {
                     QRP fact (m, type);
                     if (type == QR::economy)
-                      retval(2) = fact.Pvec ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.Pvec ());
                     else
-                      retval(2) = fact.P ();
-                    retval(1) = get_qr_r (fact);
-                    retval(0) = fact.Q ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.P ());
                   }
                   break;
                 }
@@ -413,11 +408,9 @@
                   {
                     ComplexQRP fact (m, type);
                     if (type == QR::economy)
-                      retval(2) = fact.Pvec ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.Pvec ());
                     else
-                      retval(2) = fact.P ();
-                    retval(1) = get_qr_r (fact);
-                    retval(0) = fact.Q ();
+                      retval = ovl (fact.Q (), get_qr_r (fact), fact.P ());
                   }
                   break;
                 }
--- a/libinterp/dldfcn/symbfact.cc	Mon Dec 14 15:34:39 2015 -0800
+++ b/libinterp/dldfcn/symbfact.cc	Mon Dec 14 17:53:27 2015 -0800
@@ -96,13 +96,14 @@
 @end table\n\
 @end deftypefn")
 {
-  octave_value_list retval;
+#ifdef HAVE_CHOLMOD
+
   int nargin = args.length ();
 
   if (nargin < 1 || nargin > 3 || nargout > 5)
     print_usage ();
 
-#ifdef HAVE_CHOLMOD
+  octave_value_list retval;
 
   cholmod_common Common;
   cholmod_common *cm = &Common;