diff src/symtab.cc @ 4261:bdaa0d3dfc0b

[project @ 2003-01-02 22:55:23 by jwe]
author jwe
date Thu, 02 Jan 2003 22:55:23 +0000
parents a5a68c0afe56
children 5b075bd78a91
line wrap: on
line diff
--- a/src/symtab.cc	Thu Jan 02 17:59:17 2003 +0000
+++ b/src/symtab.cc	Thu Jan 02 22:55:23 2003 +0000
@@ -247,9 +247,10 @@
     {
       octave_value tmp (f);
 
-      delete definition;
-
-      definition = new symbol_def (tmp, sym_type);
+      if (! definition)
+	definition = new symbol_def (tmp, sym_type);
+      else
+	definition->define (tmp, sym_type);
 
       retval = true;
     }
@@ -260,16 +261,19 @@
 void
 symbol_record::clear (void)
 {
-  if (! tagged_static)
+  if (is_defined ())
     {
-      if (--definition->count <= 0)
-	delete definition;
+      if (! tagged_static)
+	{
+	  if (--definition->count <= 0)
+	    delete definition;
 
-      definition = new symbol_def ();
-    }
+	  definition = new symbol_def ();
+	}
 
-  if (linked_to_global)
-    linked_to_global = 0;
+      if (linked_to_global)
+	linked_to_global = 0;
+    }
 }
 
 void