ref: df4a8f8abb21c4d88a06c140e57da14a240e42cb
parent: 7ac411976ba25a99ef02199e86c42abd8917c5a1
author: cancel <cancel@cancel.fm>
date: Wed Jan 15 12:57:36 EST 2020
Cleanup
--- a/sysmisc.c
+++ b/sysmisc.c
@@ -400,6 +400,7 @@
switch (conf_save_start(&ezcw->save)) {
case Conf_save_start_ok:
error = Ezconf_write_ok;
+ ezcw->file = ezcw->save.tempfile;
break;
case Conf_save_start_alloc_failed:
error = Ezconf_write_oom;
@@ -523,6 +524,7 @@
conf_save_cancel(&ezcw->save);
// ^- Sets tempfile to null, which we use as a guard at the top of this
// function.
+ ezcw->file = NULL;
ezcw->stateflags = 0;
return false;
commit:;
@@ -541,6 +543,7 @@
error = Ezconf_write_rename_failed;
break;
}
+ ezcw->file = NULL;
ezcw->error = error;
ezcw->stateflags = 0;
return false;
--- a/sysmisc.h
+++ b/sysmisc.h
@@ -119,6 +119,7 @@
Confopt_w *opts;
size_t optscount;
intptr_t optid;
+ FILE *file;
Ezconf_write_error error;
U32 stateflags;
} Ezconf_write;
--- a/tui_main.c
+++ b/tui_main.c
@@ -2433,11 +2433,11 @@
switch (ez.optid) {
#ifdef FEAT_PORTMIDI
case Confopt_portmidi_output_device:
- fputs(osoc(midi_output_device_name), ez.save.tempfile);
+ fputs(osoc(midi_output_device_name), ez.file);
break;
#endif
case Confopt_margins:
- fprintf(ez.save.tempfile, "%dx%d", softmargin_x, softmargin_y);
+ fprintf(ez.file, "%dx%d", softmargin_x, softmargin_y);
break;
}
}