changeset 27445:c98953e85220

eliminate unused object_count variable in cdef_class_rep * cdef-class.h, cdef-class.cc (cdef_class::cdef_class_rep::object_count): Delete that is set but never used for any other purpose. (cdef_class::cdef_class_rep): Use private default copy constructor. (cdef_class::cdef_class_rep::register_object, cdef_class::cdef_class_rep::unregister_object, (cdef_class::register_object, cdef_class::unregister_object): Delete. * cdef-object.h, cdef-object.cc (cdef_object_base::register_object, cdef_object_base::register_object): Delete. Remove all uses.
author John W. Eaton <jwe@octave.org>
date Thu, 26 Sep 2019 10:34:59 -0400
parents 160930a3e5ee
children c23aee2104de
files libinterp/octave-value/cdef-class.cc libinterp/octave-value/cdef-class.h libinterp/octave-value/cdef-object.cc libinterp/octave-value/cdef-object.h
diffstat 4 files changed, 6 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/cdef-class.cc	Wed Sep 25 13:49:37 2019 -0400
+++ b/libinterp/octave-value/cdef-class.cc	Thu Sep 26 10:34:59 2019 -0400
@@ -79,7 +79,7 @@
 
   cdef_class::cdef_class_rep::cdef_class_rep (const std::list<cdef_class>& superclasses)
     : cdef_meta_object_rep (), member_count (0), handle_class (false),
-      object_count (0), meta (false)
+      meta (false)
   {
     put ("SuperClasses", to_ov (superclasses));
     implicit_ctor_list = superclasses;
--- a/libinterp/octave-value/cdef-class.h	Wed Sep 25 13:49:37 2019 -0400
+++ b/libinterp/octave-value/cdef-class.h	Thu Sep 26 10:34:59 2019 -0400
@@ -55,7 +55,7 @@
     public:
       cdef_class_rep (void)
         : cdef_meta_object_rep (), member_count (0), handle_class (false),
-          object_count (0), meta (false)
+          meta (false)
       { }
 
       cdef_class_rep (const std::list<cdef_class>& superclasses);
@@ -127,10 +127,6 @@
 
       bool is_handle_class (void) const { return handle_class; }
 
-      void register_object (void) { object_count++; }
-
-      void unregister_object (void) { object_count--; }
-
       octave_idx_type static_count (void) const { return member_count; }
 
       void destroy (void)
@@ -198,10 +194,6 @@
 
       std::list<cdef_class> implicit_ctor_list;
 
-      // The number of objects of this class.
-
-      refcount<octave_idx_type> object_count;
-
       // TRUE if this class is a built-in meta class.
 
       bool meta;
@@ -213,12 +205,7 @@
       typedef std::map<std::string,cdef_property>::iterator property_iterator;
       typedef std::map<std::string,cdef_property>::const_iterator property_const_iterator;
 
-      cdef_class_rep (const cdef_class_rep& c)
-        : cdef_meta_object_rep (c), directory (c.directory),
-          method_map (c.method_map), property_map (c.property_map),
-          member_count (c.member_count), handle_class (c.handle_class),
-          implicit_ctor_list (c.implicit_ctor_list),
-          object_count (c.object_count), meta (c.meta) { }
+      cdef_class_rep (const cdef_class_rep& c) = default;
     };
 
   public:
@@ -384,10 +371,6 @@
 
     bool is_meta_class (void) const { return get_rep ()->is_meta_class (); }
 
-    void register_object (void) { get_rep ()->register_object (); }
-
-    void unregister_object (void) { get_rep ()->unregister_object (); }
-
   public:
 
     enum
--- a/libinterp/octave-value/cdef-object.cc	Wed Sep 25 13:49:37 2019 -0400
+++ b/libinterp/octave-value/cdef-object.cc	Thu Sep 26 10:34:59 2019 -0400
@@ -195,33 +195,7 @@
         || (klass.ok () && ! cls.ok ())
         || (! klass.ok () && cls.ok ()))
       {
-        unregister_object ();
         klass = cls;
-        register_object ();
-      }
-  }
-
-  void
-  cdef_object_base::register_object (void)
-  {
-    if (klass.ok ())
-      {
-        cdef_class cls (get_class ());
-
-        if (cls.ok ())
-          cls.register_object ();
-      }
-  }
-
-  void
-  cdef_object_base::unregister_object (void)
-  {
-    if (klass.ok ())
-      {
-        cdef_class cls (get_class ());
-
-        if (cls.ok ())
-          cls.unregister_object ();
       }
   }
 
--- a/libinterp/octave-value/cdef-object.h	Wed Sep 25 13:49:37 2019 -0400
+++ b/libinterp/octave-value/cdef-object.h	Thu Sep 26 10:34:59 2019 -0400
@@ -342,13 +342,11 @@
 
     cdef_object_base (void)
       : cdef_object_rep (), klass ()
-    {
-      register_object ();
-    }
+    { }
 
     cdef_object_base& operator = (const cdef_object_base&) = delete;
 
-    ~cdef_object_base (void) { unregister_object (); }
+    ~cdef_object_base (void) { }
 
     cdef_class get_class (void) const;
 
@@ -366,16 +364,10 @@
     // Restricted copying!
     cdef_object_base (const cdef_object_base& obj)
       : cdef_object_rep (obj), klass (obj.klass)
-    {
-      register_object ();
-    }
+    { }
 
   private:
 
-    void register_object (void);
-
-    void unregister_object (void);
-
     // The class of the object
     cdef_object klass;
   };