changeset 31835:80eff88db003

Use member variable m_matrix rather than bool_array_value () in save routines (bug #63803) * ov-bool-mat.cc (save_binary, save_hdf5): Don't call bool_array_value() to create an intermediate variable and then get the data() pointer to it. Instead, get the data() pointer of the object directly which is stored as m_matrix.
author Rik <rik@octave.org>
date Thu, 16 Feb 2023 08:00:45 -0800
parents 4d8c66b8ea3e
children 2bf580e9f423
files libinterp/octave-value/ov-bool-mat.cc
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-bool-mat.cc	Thu Feb 16 09:31:08 2023 +0100
+++ b/libinterp/octave-value/ov-bool-mat.cc	Thu Feb 16 08:00:45 2023 -0800
@@ -361,9 +361,8 @@
       os.write (reinterpret_cast<char *> (&tmp), 4);
     }
 
-  boolNDArray m = bool_array_value ();
-  const bool *mtmp = m.data ();
-  octave_idx_type nel = m.numel ();
+  const bool *mtmp = m_matrix.data ();
+  octave_idx_type nel = m_matrix.numel ();
   os.write (reinterpret_cast<const char*> (mtmp), nel);
 
   return true;
@@ -439,7 +438,6 @@
   int rank = dv.ndims ();
   hid_t space_hid, data_hid;
   space_hid = data_hid = -1;
-  boolNDArray m = bool_array_value ();
 
   OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
 
@@ -463,7 +461,7 @@
       return false;
     }
 
-  const bool *mtmp = m.data ();
+  const bool *mtmp = m_matrix.data ();
 
   retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, octave_H5S_ALL, octave_H5S_ALL,
                      octave_H5P_DEFAULT,