dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] standard_file: Add else clause


From: Simon Marchi
Subject: [PATCH 1/2] standard_file: Add else clause
Date: Fri, 22 Jan 2016 15:22:29 -0500

I think that the current form:

  if ( !is_remote } {
    # Do non-remote stuff and return
  }
  # Do remote stuff

is not very clear and that this would be more readable.

  if ( !is_remote } {
    # Do non-remote stuff
  } else {
    # Do remote stuff
  }

That's all.

ChangeLog:

        * lib/remote.exp (standard_file); Add else clause.
---
 lib/remote.exp | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/lib/remote.exp b/lib/remote.exp
index bddf2ae..688680b 100644
--- a/lib/remote.exp
+++ b/lib/remote.exp
@@ -762,21 +762,22 @@ proc standard_file { dest op args } {
                return
            }
        }
-    }
-    switch $op {
-       exists {
-           set status [remote_exec $dest "test -f $file"]
-           return [lindex $status 0]
-       }
-       delete {
-           set file ""
-           # Allow multiple files to be deleted at once.
-           foreach x $args {
-               append file " $x"
+    } else {
+       switch $op {
+           exists {
+               set status [remote_exec $dest "test -f $file"]
+               return [lindex $status 0]
+           }
+           delete {
+               set file ""
+               # Allow multiple files to be deleted at once.
+               foreach x $args {
+                   append file " $x"
+               }
+               verbose "remote_file deleting $file"
+               set status [remote_exec $dest "rm -f $file"]
+               return [lindex $status 0]
            }
-           verbose "remote_file deleting $file"
-           set status [remote_exec $dest "rm -f $file"]
-           return [lindex $status 0]
        }
     }
 }
-- 
2.5.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]