shithub: orca

Download patch

ref: c6d981d35bb7b93b9b43e1920d45a71f00328dd3
parent: 967db0cbf26360630c1530b6161e178f53557471
author: cancel <cancel@cancel.fm>
date: Wed Feb 12 17:51:31 EST 2020

Remove duplicated field load error strings

--- a/cli_main.c
+++ b/cli_main.c
@@ -76,27 +76,7 @@
   Field_load_error fle = field_load_file(input_file, &field);
   if (fle != Field_load_error_ok) {
     field_deinit(&field);
-    char const *errstr = "Unknown";
-    switch (fle) {
-    case Field_load_error_ok:
-      break;
-    case Field_load_error_cant_open_file:
-      errstr = "Unable to open file";
-      break;
-    case Field_load_error_too_many_columns:
-      errstr = "Grid file has too many columns";
-      break;
-    case Field_load_error_too_many_rows:
-      errstr = "Grid file has too many rows";
-      break;
-    case Field_load_error_no_rows_read:
-      errstr = "Grid file has no rows";
-      break;
-    case Field_load_error_not_a_rectangle:
-      errstr = "Grid file is not a rectangle";
-      break;
-    }
-    fprintf(stderr, "File load error: %s.\n", errstr);
+    fprintf(stderr, "File load error: %s.\n", field_load_error_string(fle));
     return 1;
   }
   Mbuf_reusable mbuf_r;