Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] (cli/cli-cmds.c) ARI fix: Avoid assignment inside if statement
@ 2012-12-23 19:00 Pierre Muller
  2012-12-24  4:17 ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Pierre Muller @ 2012-12-23 19:00 UTC (permalink / raw)
  To: gdb-patches

  Looks almost obvious, but
as it's the first of that kind,
I thought I will send it as RFA nonetheless...
  
  Can similar changes be committed as obvious?
They usually require some formatting changes,
but generated behavior should not change.


Pierre Muller
as ARI maintainer


2012-12-20  Pierre Muller  <muller@sourceware.org>

        ARI fixes: Assignment within if rule.
        * cli/cli-cmds.c (shell_escape): Do not set variable value inside
        if statement.
        (edit_command): Likewise.

Index: src/gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.143
diff -u -p -r1.143 cli-cmds.c
--- src/gdb/cli/cli-cmds.c      18 Dec 2012 19:27:35 -0000      1.143
+++ src/gdb/cli/cli-cmds.c      20 Dec 2012 16:10:27 -0000
@@ -724,11 +724,13 @@ shell_escape (char *arg, int from_tty)
 #else /* Can fork.  */
   int status, pid;

-  if ((pid = vfork ()) == 0)
+  pid = vfork ();
+  if (pid == 0)
     {
       const char *p, *user_shell;

-      if ((user_shell = (char *) getenv ("SHELL")) == NULL)
+      user_shell = (char *) getenv ("SHELL");
+      if (user_shell == NULL)
        user_shell = "/bin/sh";

       /* Get the name of the shell for arg0.  */
@@ -837,7 +839,8 @@ edit_command (char *arg, int from_tty)
         error (_("No line number known for %s."), arg);
     }

-  if ((editor = (char *) getenv ("EDITOR")) == NULL)
+  editor = (char *) getenv ("EDITOR");
+  if (editor == NULL)
       editor = "/bin/ex";

   /* If we don't already know the full absolute file name of the


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <001201cde13f$af3ad4b0$0db07e10$%muller@ics-cnrs.unistra.fr>]

end of thread, other threads:[~2013-01-11  4:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-23 19:00 [RFA] (cli/cli-cmds.c) ARI fix: Avoid assignment inside if statement Pierre Muller
2012-12-24  4:17 ` Joel Brobecker
2012-12-24 10:22   ` Andreas Schwab
     [not found] <001201cde13f$af3ad4b0$0db07e10$%muller@ics-cnrs.unistra.fr>
2012-12-23 19:29 ` Eli Zaretskii
2012-12-23 21:58   ` Pierre Muller
2012-12-23 22:28   ` Andreas Schwab
2012-12-24  3:41     ` Eli Zaretskii
2012-12-24 10:17       ` Andreas Schwab
2013-01-10 12:28       ` Pierre Muller
2013-01-11  4:29         ` Joel Brobecker
2012-12-23 22:28   ` Sergio Durigan Junior
2012-12-24  4:11     ` Joel Brobecker

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