Patchwork [2/5] Change argument 'args' of get_tracepoint_by_number to char *

login
register
mail settings
Submitter Yao Qi
Date March 13, 2014, 2:32 a.m.
Message ID <1394677950-4054-3-git-send-email-yao@codesourcery.com>
Download mbox | patch
Permalink /patch/59/
State New
Headers show

Comments

Yao Qi - March 13, 2014, 2:32 a.m.
We pass the reference to a char pointer to get_tracepoint_by_number,
but the char pointer isn't used afterwards, so looks it should be
fine to pass a char pointer to get_tracepoint_by_number.

gdb:

2014-03-13  Yao Qi  <yao@codesourcery.com>

	* breakpoint.c (get_tracepoint_by_number): Change type of
	'args' to 'char *'.  Update pointer checking.  All callers
	updated.
	* breakpoint.h (get_tracepoint_by_number): Update declaration.
---
 gdb/breakpoint.c |   10 +++++-----
 gdb/breakpoint.h |    2 +-
 gdb/tracepoint.c |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 800cead..211c2aa 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15532,7 +15532,7 @@  trace_pass_command (char *args, int from_tty)
     }
   else if (*args == '\0')
     {
-      t1 = get_tracepoint_by_number (&args);
+      t1 = get_tracepoint_by_number (args);
       if (t1)
 	trace_pass_set_count (t1, count, from_tty);
     }
@@ -15592,12 +15592,12 @@  get_tracepoint_by_number_on_target (int num)
    (tracepoint_count) is returned.  */
 
 struct tracepoint *
-get_tracepoint_by_number (char **arg)
+get_tracepoint_by_number (char *arg)
 {
   struct breakpoint *t;
   int tpnum;
 
-  if (arg == NULL || *arg == NULL || ! **arg)
+  if (arg == NULL || *arg == 0)
     {
       if (tracepoint_count == 0)
 	{
@@ -15609,9 +15609,9 @@  get_tracepoint_by_number (char **arg)
     }
   else
     {
-      char *instring = *arg;
+      char *instring = arg;
 
-      tpnum = get_number (arg);
+      tpnum = get_number (&arg);
 
       if (tpnum == 0)
 	{
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index c1ed2e6..c240516 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1490,7 +1490,7 @@  extern struct tracepoint *get_tracepoint_by_number_on_target (int num);
 
 /* Find a tracepoint by parsing a number in the supplied string.  */
 extern struct tracepoint *
-     get_tracepoint_by_number (char **arg);
+     get_tracepoint_by_number (char *arg);
 
 /* Return a vector of all tracepoints currently defined.  The vector
    is newly allocated; the caller should free when done with it.  */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index cea40e3..a5bc7d1 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -653,7 +653,7 @@  trace_actions_command (char *args, int from_tty)
   struct tracepoint *t;
   struct command_line *l;
 
-  t = get_tracepoint_by_number (&args);
+  t = get_tracepoint_by_number (args);
   if (t)
     {
       char *tmpbuf =