This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Minor simplification of (Python) find_thread_object


Since the reference to the Inferior Python object is managed by
gdbpy_ref (RAII), we can return directly from the loop.  It's just a
leftover from the cleanups era.

gdb/ChangeLog:

	* python/py-inferior.c (find_thread_object): Return directly
	from the loop.  Remove "found" variable.
---
 gdb/python/py-inferior.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 9e10d62c51..f3ae82ed54 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -264,13 +264,7 @@ find_thread_object (ptid_t ptid)
   for (thread = ((inferior_object *)(inf_obj.get ()))->threads; thread;
        thread = thread->next)
     if (ptid_equal (thread->thread_obj->thread->ptid, ptid))
-      {
-	found = thread->thread_obj;
-	break;
-      }
-
-  if (found)
-    return found;
+      return thread->thread_obj;
 
   return NULL;
 }
-- 
2.11.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]