changeset 30156:c8d5ec1f5618

maint: use "m_" prefix for member variable "instance" in class interpreter. * interpreter.cc, interpreter.h: Use "m_" prefix for member variable "instance" in class interpreter. Order member functions before member variables in class.
author Rik <rik@octave.org>
date Fri, 10 Sep 2021 07:20:43 -0700
parents 14b098a6ba46
children b709d7b41cf8
files libinterp/corefcn/interpreter.cc libinterp/corefcn/interpreter.h
diffstat 2 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Fri Sep 10 07:02:04 2021 -0700
+++ b/libinterp/corefcn/interpreter.cc	Fri Sep 10 07:20:43 2021 -0700
@@ -489,11 +489,11 @@
     //
     //   only one Octave interpreter may be active in any given thread
 
-    if (instance)
+    if (m_instance)
       throw std::runtime_error
         ("only one Octave interpreter may be active");
 
-    instance = this;
+    m_instance = this;
 
     // Matlab uses "C" locale for LC_NUMERIC class regardless of local setting
     setlocale (LC_ALL, "");
@@ -644,7 +644,7 @@
     octave_interpreter_ready = true;
   }
 
-  OCTAVE_THREAD_LOCAL interpreter *interpreter::instance = nullptr;
+  OCTAVE_THREAD_LOCAL interpreter *interpreter::m_instance = nullptr;
 
   interpreter::~interpreter (void)
   {
--- a/libinterp/corefcn/interpreter.h	Fri Sep 10 07:02:04 2021 -0700
+++ b/libinterp/corefcn/interpreter.h	Fri Sep 10 07:20:43 2021 -0700
@@ -562,20 +562,10 @@
     }
     #endif
 
-    static interpreter * the_interpreter (void) { return instance; }
+    static interpreter * the_interpreter (void) { return m_instance; }
 
   private:
 
-    // The interpreter instance;  Currently it is only possible to
-    // have one, so OCTAVE_THREAD_LOCAL will normally be defined to be
-    // empty.  Eventually we would like to allow multiple interpreters
-    // to be active at once, but they will still be limited to one per
-    // thread.  When that is possible, OCTAVE_THREAD_LOCAL can be
-    // replaced by the C++ thread_local keyword.  For now, use a macro
-    // to allow experimenting with thread_local storage.
-
-    OCTAVE_THREAD_LOCAL static interpreter *instance;
-
     void display_startup_message (void) const;
 
     int execute_startup_files (void);
@@ -590,6 +580,22 @@
 
     void execute_atexit_fcns (void);
 
+    void maximum_braindamage (void);
+
+    void execute_pkg_add (const std::string& dir);
+
+    //--------
+
+    // The interpreter instance;  Currently it is only possible to
+    // have one, so OCTAVE_THREAD_LOCAL will normally be defined to be
+    // empty.  Eventually we would like to allow multiple interpreters
+    // to be active at once, but they will still be limited to one per
+    // thread.  When that is possible, OCTAVE_THREAD_LOCAL can be
+    // replaced by the C++ thread_local keyword.  For now, use a macro
+    // to allow experimenting with thread_local storage.
+
+    OCTAVE_THREAD_LOCAL static interpreter *m_instance;
+
     application *m_app_context;
 
     temporary_file_list m_tmp_files;
@@ -664,10 +670,6 @@
     bool m_executing_atexit;
 
     bool m_initialized;
-
-    void maximum_braindamage (void);
-
-    void execute_pkg_add (const std::string& dir);
   };
 
 OCTAVE_NAMESPACE_END