changeset 5477:9e59c91ddc99

[project @ 2005-09-30 05:26:38 by jwe]
author jwe
date Fri, 30 Sep 2005 05:26:38 +0000
parents 941f0fc6b596
children 927230cb3e77
files src/ChangeLog src/ov.cc
diffstat 2 files changed, 15 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Sep 29 22:49:43 2005 +0000
+++ b/src/ChangeLog	Fri Sep 30 05:26:38 2005 +0000
@@ -1,3 +1,8 @@
+2005-09-30  John W. Eaton  <jwe@octave.org>
+
+	* ov.cc (octave_value::~octave_value): No need to set rep to zero
+	after deleting.
+
 2005-09-29  John W. Eaton  <jwe@octave.org>
 
 	* syscalls.cc (mk_stat_map): Store mode too.
--- a/src/ov.cc	Thu Sep 29 22:49:43 2005 +0000
+++ b/src/ov.cc	Fri Sep 30 05:26:38 2005 +0000
@@ -416,26 +416,18 @@
 }
 
 octave_value::octave_value (const Cell& c, bool is_csl)
-  : rep (0)
+  : rep (is_csl
+	 ? dynamic_cast<octave_value *> (new octave_cs_list (c))
+	 : dynamic_cast<octave_value *> (new octave_cell (c)))
 {
-  if (is_csl)
-    rep = new octave_cs_list (c);
-  else
-    rep = new octave_cell (c);
-
   rep->count = 1;
 }
 
 octave_value::octave_value (const ArrayN<octave_value>& a, bool is_csl)
-  : rep (0)
+  : rep (is_csl
+	 ? dynamic_cast<octave_value *> (new octave_cs_list (Cell (a)))
+	 : dynamic_cast<octave_value *> (new octave_cell (Cell (a))))
 {
-  Cell c (a);
-
-  if (is_csl)
-    rep = new octave_cs_list (c);
-  else
-    rep = new octave_cell (c);
-
   rep->count = 1;
 }
 
@@ -779,13 +771,10 @@
 }
 
 octave_value::octave_value (const octave_value_list& l, bool is_csl)
-  : rep (0)
+  : rep (is_csl
+	 ? dynamic_cast<octave_value *> (new octave_cs_list (l))
+	 : dynamic_cast<octave_value *> (new octave_list (l)))
 {
-  if (is_csl)
-    rep = new octave_cs_list (l);
-  else
-    rep = new octave_list (l);
-
   rep->count = 1;
 }
 
@@ -815,10 +804,7 @@
 #endif
 
   if (rep && --rep->count == 0)
-    {
-      delete rep;
-      rep = 0;
-    }
+    delete rep;
 }
 
 octave_value *