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]

Re: [PATCH] gdb bug 12417


On 09/19/2012 06:59 PM, Mohsan Saleem wrote:
--- /root/Desktop/gdb/thread.c	2012-09-03 00:53:02.620254912 -0700
+++ ./gdb/thread.c	2012-09-03 00:58:04.399469614 -0700
@@ -243,12 +243,14 @@
  struct thread_info *
  add_thread_with_info (ptid_t ptid, struct private_thread_info *private)
  {
+  char *name;
    struct thread_info *result = add_thread_silent (ptid);

+ name = result->name ? result->name : target_thread_name (result);

This pattern is used five times in your patch, and why don't we move it to a function? like,


const char *
thread_info_name (struct thread_info *ti)
{
  return ti->name ? ti->name : target_thread_name (ti);
}

and call this function when needed.

--
Yao


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