Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Speed up the 'if/else'
@ 2009-08-30  2:56 Jiang Jilin
  2009-08-30  7:13 ` Paul Pluzhnikov
  2009-08-30 13:15 ` Mark Kettenis
  0 siblings, 2 replies; 4+ messages in thread
From: Jiang Jilin @ 2009-08-30  2:56 UTC (permalink / raw)
  To: msnyder, teawater; +Cc: gdb-patches, Jiang Jilin

2009-08-30  Jiang Jilin <freephp@gmail.com>

	* reverse.c (exec_reverse_once): add 'else' to speed up
---
 gdb/reverse.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/reverse.c b/gdb/reverse.c
index ee59cf3..f2af6d1 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -48,9 +48,8 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
   struct cleanup *old_chain;
 
   if (dir == EXEC_ERROR)
-    error (_("Target %s does not support this command."), target_shortname);
-
-  if (dir == EXEC_REVERSE)
+    error (_("Target %s does not support this command."), target_shortname); 
+  else if (dir == EXEC_REVERSE)
     error (_("Already in reverse mode.  Use '%s' or 'set exec-dir forward'."),
 	   cmd);
 
-- 
1.5.4.3


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

* Re: [PATCH] Speed up the 'if/else'
  2009-08-30  2:56 [PATCH] Speed up the 'if/else' Jiang Jilin
@ 2009-08-30  7:13 ` Paul Pluzhnikov
  2009-08-30  8:41   ` Jiang Jilin
  2009-08-30 13:15 ` Mark Kettenis
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Pluzhnikov @ 2009-08-30  7:13 UTC (permalink / raw)
  To: Jiang Jilin; +Cc: msnyder, teawater, gdb-patches

On Sat, Aug 29, 2009 at 6:12 PM, Jiang Jilin<freephp@gmail.com> wrote:
> 2009-08-30  Jiang Jilin <freephp@gmail.com>
>
>        * reverse.c (exec_reverse_once): add 'else' to speed up

What exactly are you trying to speed up here?

Your patch looks bogus to me (because 'error (...)' call never returns).

> ---
>  gdb/reverse.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/reverse.c b/gdb/reverse.c
> index ee59cf3..f2af6d1 100644
> --- a/gdb/reverse.c
> +++ b/gdb/reverse.c
> @@ -48,9 +48,8 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
>   struct cleanup *old_chain;
>
>   if (dir == EXEC_ERROR)
> -    error (_("Target %s does not support this command."), target_shortname);
> -
> -  if (dir == EXEC_REVERSE)
> +    error (_("Target %s does not support this command."), target_shortname);
> +  else if (dir == EXEC_REVERSE)
>     error (_("Already in reverse mode.  Use '%s' or 'set exec-dir forward'."),
>           cmd);
>
> --
> 1.5.4.3
>
>



-- 
Paul Pluzhnikov


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

* Re: [PATCH] Speed up the 'if/else'
  2009-08-30  7:13 ` Paul Pluzhnikov
@ 2009-08-30  8:41   ` Jiang Jilin
  0 siblings, 0 replies; 4+ messages in thread
From: Jiang Jilin @ 2009-08-30  8:41 UTC (permalink / raw)
  To: Paul Pluzhnikov; +Cc: msnyder, teawater, gdb-patches

On Sun, Aug 30, 2009 at 1:35 PM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote:
> On Sat, Aug 29, 2009 at 6:12 PM, Jiang Jilin<freephp@gmail.com> wrote:
>> 2009-08-30  Jiang Jilin <freephp@gmail.com>
>>
>>        * reverse.c (exec_reverse_once): add 'else' to speed up
>
> What exactly are you trying to speed up here?
>
> Your patch looks bogus to me (because 'error (...)' call never returns).

Thanks for your explanation ! I remember that 'error()' just jumps to
the location in which setjmp() locates.

the patch should be ignored.

Thanks!

Jiang


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

* Re: [PATCH] Speed up the 'if/else'
  2009-08-30  2:56 [PATCH] Speed up the 'if/else' Jiang Jilin
  2009-08-30  7:13 ` Paul Pluzhnikov
@ 2009-08-30 13:15 ` Mark Kettenis
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Kettenis @ 2009-08-30 13:15 UTC (permalink / raw)
  To: freephp; +Cc: msnyder, teawater, gdb-patches, freephp

> From: Jiang Jilin <freephp@gmail.com>
> Date: Sun, 30 Aug 2009 09:12:26 +0800
> 
> 2009-08-30  Jiang Jilin <freephp@gmail.com>
> 
> 	* reverse.c (exec_reverse_once): add 'else' to speed up

Sorry, but this is pointless and only makes the code harder to read.

> diff --git a/gdb/reverse.c b/gdb/reverse.c
> index ee59cf3..f2af6d1 100644
> --- a/gdb/reverse.c
> +++ b/gdb/reverse.c
> @@ -48,9 +48,8 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
>    struct cleanup *old_chain;
>  
>    if (dir == EXEC_ERROR)
> -    error (_("Target %s does not support this command."), target_shortname);
> -
> -  if (dir == EXEC_REVERSE)
> +    error (_("Target %s does not support this command."), target_shortname); 
> +  else if (dir == EXEC_REVERSE)
>      error (_("Already in reverse mode.  Use '%s' or 'set exec-dir forward'."),
>  	   cmd);
>  
> -- 
> 1.5.4.3
> 
> 


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

end of thread, other threads:[~2009-08-30  8:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-30  2:56 [PATCH] Speed up the 'if/else' Jiang Jilin
2009-08-30  7:13 ` Paul Pluzhnikov
2009-08-30  8:41   ` Jiang Jilin
2009-08-30 13:15 ` Mark Kettenis

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