changeset 11915:97eab9de6981 release-3-0-x

Wrong if statement substituted with a switch
author Francesco Potortì <pot@gnu.org>
date Mon, 13 Oct 2008 18:16:09 +0200
parents 8275ba2cbfce
children 377d908f7e40
files scripts/ChangeLog scripts/plot/__errplot__.m
diffstat 2 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-13  Francesco Potorti  <pot@gnu.org>
+
+	* plot/__errplot__.m: Wrong if switch compared strings using ==.
+	Subsituted with a switch statement.
+
 2008-12-26  Francesco Potortì  <pot@gnu.org>
 
 	* general/prepad.m: Add reference to postpad.
--- a/scripts/plot/__errplot__.m
+++ b/scripts/plot/__errplot__.m
@@ -35,21 +35,22 @@
 
   for i = 1:nplots
     ## Set the plot type based on linestyle.
-    if (fmt.linestyle == "~")
-      ifmt = "yerr";
-    elseif (fmt.linestyle == ">")
-      ifmt = "xerr";
-    elseif (fmt.linestyle == "~>")
-      ifmt = "xyerr";
-    elseif (fmt.linestyle == "#")
-      ifmt = "box";
-    elseif (fmt.linestyle == "#~")
-      ifmt = "boxy";
-    elseif (fmt.linestyle == "#~>")
-      ifmt = "boxxy";
-    else
-      print_usage ();
-    endif
+    switch (fmt.linestyle)
+      case "~"
+	ifmt = "yerr";
+      case ">"
+	ifmt = "xerr";
+      case "~>"
+	ifmt = "xyerr";
+      case "#"
+	ifmt = "box";
+      case "#~"
+	ifmt = "boxy";
+      case "#~>"
+	ifmt = "boxxy";
+      otherwise
+	print_usage ();
+    endswitch
 
     h = __line__ (p);