home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Small refactoring of read_map_objects().
[plomrogue]
/
src
/
command_db.c
diff --git
a/src/command_db.c
b/src/command_db.c
index 7e60b1d3510386dd3101000acf3cc637025b3506..110f91f4eb2ddcf9c1fade659375e35b493526b0 100644
(file)
--- a/
src/command_db.c
+++ b/
src/command_db.c
@@
-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 <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);
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);
char line[linemax + 1];
struct Command * cmds = try_malloc(lines * sizeof(struct Command), f_name);