From: ceriel Date: Mon, 29 Jan 1990 12:40:43 +0000 (+0000) Subject: open and close output file in one place X-Git-Tag: release-5-5~1857 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=218b982231fa025b7ffc949532b9adf2f85bde29;p=ack.git open and close output file in one place --- diff --git a/util/led/memory.c b/util/led/memory.c index b852520a8..df5c2c2a3 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -581,9 +581,6 @@ write_bytes() offchar + NLChars ); } - if (! wr_open(outputname)) { - fatal("can't create %s", outputname); - } /* * These pieces must always be written. */ @@ -608,7 +605,6 @@ write_bytes() wr_dbug(mems[ALLODBUG].mem_base, mems[ALLODBUG].mem_full); #endif SYMDBUG } - wr_close(); } namecpy(name, nname, offchar) diff --git a/util/led/output.c b/util/led/output.c index 3a41140b2..e21fcdcc1 100644 --- a/util/led/output.c +++ b/util/led/output.c @@ -26,7 +26,11 @@ beginoutput() { extern ushort NLocals, NGlobals; extern long NLChars, NGChars; + extern char *outputname; + if (! wr_open(outputname)) { + fatal("can't create %s", outputname); + } if (incore) generate_section_names(); @@ -82,4 +86,5 @@ endoutput() } else { write_bytes(); } + wr_close(); } diff --git a/util/led/write.c b/util/led/write.c index 08ae54938..b65fdd19c 100644 --- a/util/led/write.c +++ b/util/led/write.c @@ -30,13 +30,9 @@ static long off_char; */ begin_write() { - extern char *outputname; register struct outhead *hd = &outhead; assert(! incore); - if (! wr_open(outputname)) { - fatal("cannot write %s", outputname); - } wr_ohead(hd); wr_sect(outsect, hd->oh_nsect); off_char = OFF_CHAR(*hd);