home · contact · privacy
Simplified textfile_sizes() and replaced all get_linemax() calls with it.
[plomrogue] / src / command_db.c
index 7e60b1d3510386dd3101000acf3cc637025b3506..110f91f4eb2ddcf9c1fade659375e35b493526b0 100644 (file)
@@ -7,7 +7,8 @@
 #include <string.h> /* for strlen(), strtok() */
 #include "main.h" /* for world global */
 #include "readwrite.h" /* for textfile_sizes(), try_fopen(), try_fclose() */
-#include "misc.h" /* for try_malloc(), exit_trouble */
+#include "misc.h" /* for try_malloc() */
+#include "rexit.h" /* exit_trouble() */
 
 
 
@@ -81,9 +82,8 @@ extern void init_command_db()
 
     char * path = "config/commands";
     FILE * file = try_fopen(path, "r", f_name);
-    uint16_t lines, linemax;
-    uint8_t test = textfile_sizes(file, &linemax, &lines);
-    exit_trouble(test, f_name, "textfile_sizes()");
+    uint16_t lines;
+    uint16_t linemax = textfile_sizes(file, &lines);
     char line[linemax + 1];
 
     struct Command * cmds = try_malloc(lines * sizeof(struct Command), f_name);