uint16_t lines, linemax;
exit_err(textfile_sizes(file, &linemax, &lines), world, err_s);
- char * line = malloc(linemax);
- exit_err(NULL == line, world, err_m);
+ char line[linemax];
struct Command * cmds = malloc(lines * sizeof(struct Command));
exit_err(NULL == line, world, err_m);
uint8_t i = 0;
copy_tokenized_string(world, &cmds[i].dsc_long, "\n", err_m);
i++;
}
- free(line);
exit_err(fclose(file), world, err_c);
world->cmd_db = malloc(sizeof(struct CommandDB));
world->monster_def = 0;
struct ItemDef * * p_p_id = &world->item_def;
struct MonsterDef * * p_p_md = &world->monster_def;
- char * defline = malloc(linemax);
- exit_err(NULL == defline, world, err_m);
+ char defline[linemax];
char * line_p;
char * delim = " ";
while (fgets(defline, linemax, file))
}
}
- free(defline);
exit_err(fclose(file), world, err_c);
}
uint16_t linemax;
exit_err(textfile_sizes(file, &linemax, NULL), world, err_s);
- char * line = malloc(linemax);
- exit_err(NULL == line, world, err_m);
+ char line[linemax];
struct WinConf * winconf = get_winconf_by_id(world, id);
exit_err(NULL == fgets(line, linemax, file), world, err_g);
winconf->width_type = 1;
}
- free(line);
exit_err(fclose(file), world, err_c);
}
extern void save_win_config(struct World * world, char id)
{
char * err_o = "Trouble in save_win_config() with fopen().";
- char * err_m = "Trouble in save_win_config() with malloc().";
char * err_c = "Trouble in save_win_config() with fclose().";
char * err_u = "Trouble in save_win_config() with unlink().";
char * err_r = "Trouble in save_win_config() with rename().";
{
size = 7;
}
- char * line = malloc(size);
- exit_err(NULL == line, world, err_m);
+ char line[size];
sprintf(line, "%s\n", wc->title);
fwrite(line, sizeof(char), strlen(line), file);
sprintf(line, "%d\n", wc->height);
save_win_config(world, 'm');
char * err_o = "Trouble in save_win_configs() with fopen().";
- char * err_m = "Trouble in save_win_configs() with calloc().";
char * err_c = "Trouble in save_win_configs() with fclose().";
char * err_u = "Trouble in save_win_configs() with unlink().";
char * err_r = "Trouble in save_win_configs() with rename().";
FILE * file = fopen(path_tmp, "w");
exit_err(NULL == file, world, err_o);
- char * line = calloc(6, sizeof(char));
- exit_err(NULL == line, world, err_m);
+ char line[6];
struct Win * w_p = world->wmeta->_chain_start;
uint8_t i = 0;
while (0 != w_p)