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 34db4dcd8db41087f789377c4e5941950e7e071f..110f91f4eb2ddcf9c1fade659375e35b493526b0 100644
(file)
--- a/
src/command_db.c
+++ b/
src/command_db.c
@@
-6,9
+6,9
@@
#include <stdint.h> /* for uint8_t */
#include <string.h> /* for strlen(), strtok() */
#include "main.h" /* for world global */
#include <stdint.h> /* for uint8_t */
#include <string.h> /* for strlen(), strtok() */
#include "main.h" /* for world global */
-#include "rexit.h" /* for exit_err() */
#include "readwrite.h" /* for textfile_sizes(), try_fopen(), try_fclose() */
#include "misc.h" /* for try_malloc() */
#include "readwrite.h" /* for textfile_sizes(), try_fopen(), try_fclose() */
#include "misc.h" /* for try_malloc() */
+#include "rexit.h" /* exit_trouble() */
@@
-79,12
+79,11
@@
extern char * get_command_longdsc(char * dsc_short)
extern void init_command_db()
{
char * f_name = "init_command_db()";
extern void init_command_db()
{
char * f_name = "init_command_db()";
- char * err_s = "Trouble in init_cmds() with textfile_sizes().";
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
;
-
exit_err(textfile_sizes(file, &linemax, &lines), err_
s);
+ uint16_t lines;
+
uint16_t linemax = textfile_sizes(file, &line
s);
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);