This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Minor simplification of (Python) find_thread_object
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: gdb-patches at sourceware dot org
- Cc: Simon Marchi <simon dot marchi at polymtl dot ca>
- Date: Sat, 21 Jan 2017 23:50:25 -0500
- Subject: [PATCH] Minor simplification of (Python) find_thread_object
- Authentication-results: sourceware.org; auth=none
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