Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 2/2] * cli/cli-decode.c (apropos_cmd): Skip traversing abbreviations for prefix commands to avoid duplicates in the output.
  2009-06-17  3:31 [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Samuel Bronson
@ 2009-06-17  3:31 ` Samuel Bronson
  2009-06-17 17:27   ` Tom Tromey
  2009-06-17 17:26 ` [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Samuel Bronson @ 2009-06-17  3:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Samuel Bronson

Signed-off-by: Samuel Bronson <naesten@gmail.com>
---
 gdb/cli/cli-decode.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index e2647fc..73c06bc 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -789,8 +789,11 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
 				      0 /* don't recurse */, stream);
 	    }
 	}
-      /* Check if this command has subcommands */
-      if (c->prefixlist != NULL)
+      /* Check if this command has subcommands and is not an abbreviation.
+	 We skip listing subcommands of abbreviations in order to avoid
+	 duplicates in the output.
+       */
+      if (c->prefixlist != NULL && !c->abbrev_flag)
 	{
 	  /* Recursively call ourselves on the subcommand list,
 	     passing the right prefix in.
-- 
1.6.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing.
@ 2009-06-17  3:31 Samuel Bronson
  2009-06-17  3:31 ` [PATCH 2/2] * cli/cli-decode.c (apropos_cmd): Skip traversing abbreviations for prefix commands to avoid duplicates in the output Samuel Bronson
  2009-06-17 17:26 ` [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Samuel Bronson @ 2009-06-17  3:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Samuel Bronson

Signed-off-by: Samuel Bronson <naesten@gmail.com>
---
 gdb/cli/cli-decode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4ebf6dc..e2647fc 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -766,7 +766,7 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
 			 struct re_pattern_buffer *regex, char *prefix)
 {
   struct cmd_list_element *c;
-  int returnvalue=1; /*Needed to avoid double printing*/
+  int returnvalue=-1; /*Needed to avoid double printing*/
   /* Walk through the commands */
   for (c=commandlist;c;c=c->next)
     {
@@ -780,7 +780,7 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
 				      0 /* don't recurse */, stream);
 	    }
 	}
-      if (c->doc != NULL && returnvalue != 0)
+      if (c->doc != NULL && returnvalue < 0)
 	{
 	  /* Try to match against documentation */
 	  if (re_search(regex,c->doc,strlen(c->doc),0,strlen(c->doc),NULL) >=0)
-- 
1.6.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing.
  2009-06-17  3:31 [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Samuel Bronson
  2009-06-17  3:31 ` [PATCH 2/2] * cli/cli-decode.c (apropos_cmd): Skip traversing abbreviations for prefix commands to avoid duplicates in the output Samuel Bronson
@ 2009-06-17 17:26 ` Tom Tromey
  2009-06-17 20:15   ` Samuel Bronson
  2009-06-17 22:22   ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Samuel Bronson
  1 sibling, 2 replies; 8+ messages in thread
From: Tom Tromey @ 2009-06-17 17:26 UTC (permalink / raw)
  To: Samuel Bronson; +Cc: gdb-patches

>>>>> "Samuel" == Samuel Bronson <naesten@gmail.com> writes:

Samuel> Signed-off-by: Samuel Bronson <naesten@gmail.com>
Samuel> ---
Samuel>  gdb/cli/cli-decode.c |    4 ++--
Samuel>  1 files changed, 2 insertions(+), 2 deletions(-)

Needs a ChangeLog entry...

Samuel> -  int returnvalue=1; /*Needed to avoid double printing*/
Samuel> +  int returnvalue=-1; /*Needed to avoid double printing*/
Samuel>    /* Walk through the commands */
Samuel>    for (c=commandlist;c;c=c->next)
Samuel>      {

Shouldn't this reinitialize returnvalue to -1 each time through the
loop?

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] * cli/cli-decode.c (apropos_cmd): Skip traversing abbreviations for prefix commands to avoid duplicates in the output.
  2009-06-17  3:31 ` [PATCH 2/2] * cli/cli-decode.c (apropos_cmd): Skip traversing abbreviations for prefix commands to avoid duplicates in the output Samuel Bronson
@ 2009-06-17 17:27   ` Tom Tromey
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2009-06-17 17:27 UTC (permalink / raw)
  To: Samuel Bronson; +Cc: gdb-patches

>>>>> "Samuel" == Samuel Bronson <naesten@gmail.com> writes:

Samuel> Signed-off-by: Samuel Bronson <naesten@gmail.com>
Samuel> ---
Samuel>  gdb/cli/cli-decode.c |    7 +++++--
Samuel>  1 files changed, 5 insertions(+), 2 deletions(-)

Needs a ChangeLog entry.

Otherwise this looks good.
It is even small enough to go in before your paperwork arrives.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of   double printing.
  2009-06-17 17:26 ` [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Tom Tromey
@ 2009-06-17 20:15   ` Samuel Bronson
  2009-06-17 22:22   ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Samuel Bronson
  1 sibling, 0 replies; 8+ messages in thread
From: Samuel Bronson @ 2009-06-17 20:15 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches

On Wed, Jun 17, 2009 at 1:26 PM, Tom Tromey<tromey@redhat.com> wrote:
>>>>>> "Samuel" == Samuel Bronson <naesten@gmail.com> writes:
>
> Samuel> Signed-off-by: Samuel Bronson <naesten@gmail.com>
> Samuel> ---
> Samuel>  gdb/cli/cli-decode.c |    4 ++--
> Samuel>  1 files changed, 2 insertions(+), 2 deletions(-)

Oh, oops, I forgot that git uses the first line of the commit message
for the Subject.

> Samuel> -  int returnvalue=1; /*Needed to avoid double printing*/
> Samuel> +  int returnvalue=-1; /*Needed to avoid double printing*/
> Samuel>    /* Walk through the commands */
> Samuel>    for (c=commandlist;c;c=c->next)
> Samuel>      {
>
> Shouldn't this reinitialize returnvalue to -1 each time through the
> loop?

Oh ... true! Oops.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] Fix for PR gdb/9903 (part 1)
  2009-06-17 17:26 ` [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Tom Tromey
  2009-06-17 20:15   ` Samuel Bronson
@ 2009-06-17 22:22   ` Samuel Bronson
  2009-06-17 22:23     ` [PATCH 2/2] Fix for PR gdb/9903 (part 2) Samuel Bronson
  2009-06-18 17:59     ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Tom Tromey
  1 sibling, 2 replies; 8+ messages in thread
From: Samuel Bronson @ 2009-06-17 22:22 UTC (permalink / raw)
  To: gdb-patches; +Cc: Samuel Bronson

	* cli/cli-decode.c (apropos_cmd): Fix avoidance of double
	printing.

Signed-off-by: Samuel Bronson <naesten@gmail.com>
---
 gdb/cli/cli-decode.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4ebf6dc..cd4c984 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -766,10 +766,11 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
 			 struct re_pattern_buffer *regex, char *prefix)
 {
   struct cmd_list_element *c;
-  int returnvalue=1; /*Needed to avoid double printing*/
+  int returnvalue;
   /* Walk through the commands */
   for (c=commandlist;c;c=c->next)
     {
+      returnvalue = -1; /*Needed to avoid double printing*/
       if (c->name != NULL)
 	{
 	  /* Try to match against the name*/
@@ -780,7 +781,7 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
 				      0 /* don't recurse */, stream);
 	    }
 	}
-      if (c->doc != NULL && returnvalue != 0)
+      if (c->doc != NULL && returnvalue < 0)
 	{
 	  /* Try to match against documentation */
 	  if (re_search(regex,c->doc,strlen(c->doc),0,strlen(c->doc),NULL) >=0)
-- 
1.6.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] Fix for PR gdb/9903 (part 2)
  2009-06-17 22:22   ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Samuel Bronson
@ 2009-06-17 22:23     ` Samuel Bronson
  2009-06-18 17:59     ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Tom Tromey
  1 sibling, 0 replies; 8+ messages in thread
From: Samuel Bronson @ 2009-06-17 22:23 UTC (permalink / raw)
  To: gdb-patches; +Cc: Samuel Bronson

	* cli/cli-decode.c (apropos_cmd): Skip traversing abbreviations
        for prefix commands to avoid duplicates in the output.

Signed-off-by: Samuel Bronson <naesten@gmail.com>
---
 gdb/cli/cli-decode.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index cd4c984..c842889 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -790,8 +790,11 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
 				      0 /* don't recurse */, stream);
 	    }
 	}
-      /* Check if this command has subcommands */
-      if (c->prefixlist != NULL)
+      /* Check if this command has subcommands and is not an abbreviation.
+	 We skip listing subcommands of abbreviations in order to avoid
+	 duplicates in the output.
+       */
+      if (c->prefixlist != NULL && !c->abbrev_flag)
 	{
 	  /* Recursively call ourselves on the subcommand list,
 	     passing the right prefix in.
-- 
1.6.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] Fix for PR gdb/9903 (part 1)
  2009-06-17 22:22   ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Samuel Bronson
  2009-06-17 22:23     ` [PATCH 2/2] Fix for PR gdb/9903 (part 2) Samuel Bronson
@ 2009-06-18 17:59     ` Tom Tromey
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2009-06-18 17:59 UTC (permalink / raw)
  To: Samuel Bronson; +Cc: gdb-patches

>>>>> "Samuel" == Samuel Bronson <naesten@gmail.com> writes:

Samuel> 	* cli/cli-decode.c (apropos_cmd): Fix avoidance of double
Samuel> 	printing.

These two patches look good to me.  Since they are very small I will
commit them (a bit later).  However, future patches, regardless of
size, will have to wait for your paperwork to clear.

In a case like this, where someone else is committing the patch, it is
simpler for us if you send a complete ChangeLog entry, including the
header.  (Or if not simpler, it is at least traditional :-)

Also in this particular case I would add the PR number to the
entry.  Like:

2009-06-17  Samuel Bronson  <naesten@gmail.com>

	PR cli/9930:
	* cli/cli-decode.c (apropos_cmd): Fix avoidance of double
	printing.

This addition means that the commit message will automatically be
logged in bugzilla.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-18 17:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-17  3:31 [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Samuel Bronson
2009-06-17  3:31 ` [PATCH 2/2] * cli/cli-decode.c (apropos_cmd): Skip traversing abbreviations for prefix commands to avoid duplicates in the output Samuel Bronson
2009-06-17 17:27   ` Tom Tromey
2009-06-17 17:26 ` [PATCH 1/2] * cli/cli-decode.c (apropos_cmd): Fix avoidance of double printing Tom Tromey
2009-06-17 20:15   ` Samuel Bronson
2009-06-17 22:22   ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Samuel Bronson
2009-06-17 22:23     ` [PATCH 2/2] Fix for PR gdb/9903 (part 2) Samuel Bronson
2009-06-18 17:59     ` [PATCH 1/2] Fix for PR gdb/9903 (part 1) Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox