From da19d991a0e3f2c75689f1e27f3661e28f652ca0 Mon Sep 17 00:00:00 2001
From: cancel <cancel@cancel.fm>
Date: Sun, 12 Jan 2020 08:55:00 +0900
Subject: [PATCH] Move field_load_error_string to field.h/.c

---
 field.c    | 25 +++++++++++++++++++++++++
 field.h    |  2 ++
 tui_main.c | 25 -------------------------
 3 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/field.c b/field.c
index c5e27e2..c5f8e8f 100644
--- a/field.c
+++ b/field.c
@@ -116,6 +116,31 @@ Field_load_error field_load_file(char const* filepath, Field* field) {
   return Field_load_error_ok;
 }
 
+char const* field_load_error_string(Field_load_error fle) {
+  char const* errstr = "Unknown";
+  switch (fle) {
+  case Field_load_error_ok:
+    errstr = "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;
+  }
+  return errstr;
+}
+
 void mbuf_reusable_init(Mbuf_reusable* mbr) {
   mbr->buffer = NULL;
   mbr->capacity = 0;
diff --git a/field.h b/field.h
index cd66792..50ba3fe 100644
--- a/field.h
+++ b/field.h
@@ -31,6 +31,8 @@ typedef enum {
 
 Field_load_error field_load_file(char const* filepath, Field* field);
 
+char const* field_load_error_string(Field_load_error fle);
+
 // A reusable buffer for the per-grid-cell flags. Similar to how Field is a
 // reusable buffer for Glyph, Mbuf_reusable is for Mark. The naming isn't so
 // great. Also like Field, the VM doesn't have to care about the buffer being
diff --git a/tui_main.c b/tui_main.c
index b088d8e..6690412 100644
--- a/tui_main.c
+++ b/tui_main.c
@@ -2344,31 +2344,6 @@ void try_send_to_gui_clipboard(Ged const* a, bool* io_use_gui_clipboard) {
   }
 }
 
-char const* field_load_error_string(Field_load_error fle) {
-  char const* errstr = "Unknown";
-  switch (fle) {
-  case Field_load_error_ok:
-    errstr = "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;
-  }
-  return errstr;
-}
-
 typedef struct {
   oso* portmidi_output_device;
 } Prefs;