diff --git a/Changelog b/Changelog index 6bacf4a..d3fbac1 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Cleanup save_formats(). (caf) + * Fix off-by-one error in add_socketread() and set_socketwrite() found by Coverity. (caf) diff --git a/source/fset.c b/source/fset.c index f3d810e..36ba8d5 100644 --- a/source/fset.c +++ b/source/fset.c @@ -798,13 +798,14 @@ void create_fsets(Window *win, int ansi) #endif } -int save_formats(FILE *outfile) +int save_formats(void) { -char thefile[BIG_BUFFER_SIZE+1]; -char *p; -int i; -int count = 0; -FsetNumber *tmp; + FILE *outfile; + char thefile[BIG_BUFFER_SIZE+1]; + char *p; + int i; + int count = 0; + FsetNumber *tmp; #if defined(__EMX__) || defined(WINNT) sprintf(thefile, "%s/%s.fmt", get_string_var(CTOOLZ_DIR_VAR), version); @@ -813,10 +814,10 @@ FsetNumber *tmp; #endif p = expand_twiddle(thefile); outfile = fopen(p, "w"); + new_free(&p); if (!outfile) { bitchsay("Cannot open file %s for saving!", thefile); - new_free(&p); return 1; } for (i = 0; i < NUMBER_OF_FSET; i++) @@ -835,7 +836,6 @@ FsetNumber *tmp; fclose(outfile); bitchsay("Saved %d formats to %s", count, thefile); - new_free(&p); return 0; } diff --git a/source/userlist.c b/source/userlist.c index 07307c4..171b7dd 100644 --- a/source/userlist.c +++ b/source/userlist.c @@ -93,7 +93,7 @@ extern AJoinList *ajoin_list; extern void save_idle (FILE *); extern void save_banwords (FILE *); -extern int save_formats (FILE *); +extern int save_formats (void); extern void sync_nicklist (UserList *, int); extern void sync_shitlist (ShitList *, int); @@ -1671,7 +1671,7 @@ BUILT_IN_COMMAND(savelists) /* this looks like a bug but it isn't. formats are saved in a * differant file altogether. */ - save_formats(outfile); + save_formats(); #endif } diff --git a/source/vars.c b/source/vars.c index 110e471..15aa66d 100644 --- a/source/vars.c +++ b/source/vars.c @@ -82,7 +82,6 @@ static void set_ov_mode (Window *, char *, int); static void set_away_time (Window *, char *, int); static void reinit_screen (Window *, char *, int); void reinit_status (Window *, char *, int); - int save_formats (FILE *); static void set_clock_format (Window *, char *, int); void create_fsets (Window *, int); void setup_ov_mode (int, int, int);