Change program_space_empty_p to method on program_space
authorTom Tromey <tom@tromey.com>
Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 29 Oct 2020 21:04:38 +0000 (15:04 -0600)
This changes program_space_empty_p to be a method on program_space.
It also changes it to return bool.  I removed the "_p" suffix because
"empty" is a "well-known" C++ method name.

gdb/ChangeLog
2020-10-29  Tom Tromey  <tom@tromey.com>

* inferior.c (delete_inferior): Update.
* progspace.c (program_space::empty): Rename from
program_space_empty_p.  Return bool.
* progspace.h (struct program_space) <empty>: New method.
(program_space_empty_p): Don't declare.

gdb/ChangeLog
gdb/inferior.c
gdb/progspace.c
gdb/progspace.h

index 979319425701b4fc1dc0c8fdc2122cf95948cba3..1286d579505bffe5b76e280650e90fba06d9e74c 100644 (file)
@@ -1,3 +1,11 @@
+2020-10-29  Tom Tromey  <tom@tromey.com>
+
+       * inferior.c (delete_inferior): Update.
+       * progspace.c (program_space::empty): Rename from
+       program_space_empty_p.  Return bool.
+       * progspace.h (struct program_space) <empty>: New method.
+       (program_space_empty_p): Don't declare.
+
 2020-10-29  Tom Tromey  <tom@tromey.com>
 
        * progspace.c (program_space::~program_space): Don't call
index fc21241a3744f55da3a625cffef74717d3640c42..12f4de487c451e8880db0538335ec512c6e0b6c5 100644 (file)
@@ -175,7 +175,7 @@ delete_inferior (struct inferior *todel)
   gdb::observers::inferior_removed.notify (inf);
 
   /* If this program space is rendered useless, remove it. */
-  if (program_space_empty_p (inf->pspace))
+  if (inf->pspace->empty ())
     delete inf->pspace;
 
   delete inf;
index 84baaeab292160f684b4d6e910fabc5f902b48d0..70c0f7ec2a2300ce336e4498a57c31101f5a8db8 100644 (file)
@@ -280,13 +280,10 @@ set_current_program_space (struct program_space *pspace)
 
 /* Returns true iff there's no inferior bound to PSPACE.  */
 
-int
-program_space_empty_p (struct program_space *pspace)
+bool
+program_space::empty ()
 {
-  if (find_inferior_for_program_space (pspace) != NULL)
-      return 0;
-
-  return 1;
+  return find_inferior_for_program_space (this) == nullptr;
 }
 
 /* Prints the list of program spaces and their details on UIOUT.  If
index 22805d74f37ca1618834da6e165686088afd167b..fa5247f8ac209778474da073346019ce87292fab 100644 (file)
@@ -293,6 +293,10 @@ struct program_space
      later be printed.  */
   void clear_solib_cache ();
 
+  /* Returns true iff there's no inferior bound to this program
+     space.  */
+  bool empty ();
+
   /* Unique ID number.  */
   int num = 0;
 
@@ -383,9 +387,6 @@ extern std::vector<struct program_space *>program_spaces;
 /* The current program space.  This is always non-null.  */
 extern struct program_space *current_program_space;
 
-/* Returns true iff there's no inferior bound to PSPACE.  */
-extern int program_space_empty_p (struct program_space *pspace);
-
 /* Copies program space SRC to DEST.  Copies the main executable file,
    and the main symbol file.  Returns DEST.  */
 extern struct program_space *clone_program_space (struct program_space *dest,
This page took 0.036979 seconds and 4 git commands to generate.