changeset 8175:977d5204cf67

fix null assignment for structs
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 02 Oct 2008 22:50:44 +0200
parents ea9b5f31bfac
children c9d6071b9696
files src/Cell.cc src/Cell.h src/ChangeLog src/oct-map.cc
diffstat 4 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/Cell.cc	Thu Oct 02 15:00:28 2008 -0400
+++ b/src/Cell.cc	Thu Oct 02 22:50:44 2008 +0200
@@ -172,6 +172,19 @@
   return *this;
 }
 
+Cell&
+Cell::delete_elements (const octave_value_list& idx_arg)
+
+{
+  Array<idx_vector> ra_idx (idx_arg.length ());
+  for (octave_idx_type i = 0; i < idx_arg.length (); i++)
+    ra_idx.xelem (i) = idx_arg(i).index_vector ();
+
+  maybe_delete_elements (ra_idx, octave_value ());
+
+  return *this;
+}
+
 octave_idx_type
 Cell::nnz (void) const
 {
--- a/src/Cell.h	Thu Oct 02 15:00:28 2008 -0400
+++ b/src/Cell.h	Thu Oct 02 22:50:44 2008 +0200
@@ -89,6 +89,8 @@
 	      const octave_value& rfv = resize_fill_value ()) const
     { return Cell (ArrayN<octave_value>::index (ra_idx, resize_ok, rfv)); }
 
+  Cell& delete_elements (const octave_value_list& idx);
+
   Cell& assign (const octave_value_list& idx, const Cell& rhs,
 		const octave_value& fill_val = octave_value ());
 
--- a/src/ChangeLog	Thu Oct 02 15:00:28 2008 -0400
+++ b/src/ChangeLog	Thu Oct 02 22:50:44 2008 +0200
@@ -1,3 +1,10 @@
+2008-10-02  Jaroslav Hajek <highegg@gmail.com>
+
+	* Cell.h (Cell::delete_elements): Declare new member function.
+	* Cell.h (Cell::delete_elements): Define it.
+	* oct-map.cc (Octave_map::maybe_delete_elements): Call delete_elements
+	instead of assign with empty Cell.
+
 2008-10-02  John W. Eaton  <jwe@octave.org>
 
 	* pt-arg-list.cc (tree_argument_list::convert_to_const_vector):
--- a/src/oct-map.cc	Thu Oct 02 15:00:28 2008 -0400
+++ b/src/oct-map.cc	Thu Oct 02 22:50:44 2008 +0200
@@ -290,7 +290,7 @@
 	{
 	  std::string k = t_keys[i];
 
-	  map[k] = contents(k).assign (idx, Cell());
+	  map[k] = contents(k).delete_elements (idx);
 
 	  if (error_state)
 	    break;