Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/5] Change argument 'args' of get_tracepoint_by_number to char *
Date: Thu, 13 Mar 2014 02:35:00 -0000	[thread overview]
Message-ID: <1394677950-4054-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1394677950-4054-1-git-send-email-yao@codesourcery.com>

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(-)

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 =
-- 
1.7.7.6


  parent reply	other threads:[~2014-03-13  2:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-13  2:35 [PATCH 0/5] Return error code in get_number Yao Qi
2014-03-13  2:35 ` [PATCH 4/5] get_number returns status in details Yao Qi
2014-03-13  2:35 ` Yao Qi [this message]
2014-03-13  2:35 ` [PATCH 5/5] Accept convenience variable in commands -break-passcount and -break-commands Yao Qi
2014-03-14  8:22   ` Eli Zaretskii
2014-03-13  2:35 ` [PATCH 3/5] Emit wrong value error when parsing range Yao Qi
2014-03-13  2:35 ` [PATCH 1/5] Remove argument 'state' from get_tracepoint_by_number Yao Qi
2014-03-13 15:14 ` [PATCH 0/5] Return error code in get_number Tom Tromey
2014-03-14  0:59   ` Yao Qi
2014-03-14 14:38     ` Tom Tromey
2014-03-17  0:51       ` Yao Qi
2014-05-15 17:58         ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394677950-4054-3-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox