open and close output file in one place

This commit is contained in:
ceriel 1990-01-29 12:40:43 +00:00
parent 9288115a4d
commit 218b982231
3 changed files with 5 additions and 8 deletions

View file

@ -581,9 +581,6 @@ write_bytes()
offchar + NLChars offchar + NLChars
); );
} }
if (! wr_open(outputname)) {
fatal("can't create %s", outputname);
}
/* /*
* These pieces must always be written. * These pieces must always be written.
*/ */
@ -608,7 +605,6 @@ write_bytes()
wr_dbug(mems[ALLODBUG].mem_base, mems[ALLODBUG].mem_full); wr_dbug(mems[ALLODBUG].mem_base, mems[ALLODBUG].mem_full);
#endif SYMDBUG #endif SYMDBUG
} }
wr_close();
} }
namecpy(name, nname, offchar) namecpy(name, nname, offchar)

View file

@ -26,7 +26,11 @@ beginoutput()
{ {
extern ushort NLocals, NGlobals; extern ushort NLocals, NGlobals;
extern long NLChars, NGChars; extern long NLChars, NGChars;
extern char *outputname;
if (! wr_open(outputname)) {
fatal("can't create %s", outputname);
}
if (incore) if (incore)
generate_section_names(); generate_section_names();
@ -82,4 +86,5 @@ endoutput()
} else { } else {
write_bytes(); write_bytes();
} }
wr_close();
} }

View file

@ -30,13 +30,9 @@ static long off_char;
*/ */
begin_write() begin_write()
{ {
extern char *outputname;
register struct outhead *hd = &outhead; register struct outhead *hd = &outhead;
assert(! incore); assert(! incore);
if (! wr_open(outputname)) {
fatal("cannot write %s", outputname);
}
wr_ohead(hd); wr_ohead(hd);
wr_sect(outsect, hd->oh_nsect); wr_sect(outsect, hd->oh_nsect);
off_char = OFF_CHAR(*hd); off_char = OFF_CHAR(*hd);