X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fsys-file-writer.c;h=f31bd99a883e395304f1819f61e388871105f63f;hb=173d1687aea88e0e5e1b1d8615ed68ebefb15d08;hp=fcb40d379660934ac187e9e369a76ff1a0341f15;hpb=33c65b85425187f4cb06f7c8302e49d571c4c3a7;p=pspp diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index fcb40d3796..f31bd99a88 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -144,8 +144,8 @@ static void put_cmp_opcode (struct sfm_writer *, uint8_t); static void put_cmp_number (struct sfm_writer *, double); static void put_cmp_string (struct sfm_writer *, const void *, size_t); -bool write_error (const struct sfm_writer *); -bool close_writer (struct sfm_writer *); +static bool write_error (const struct sfm_writer *); +static bool close_writer (struct sfm_writer *); /* Returns default options for writing a system file. */ struct sfm_write_options @@ -159,8 +159,7 @@ sfm_writer_default_options (void) } /* Opens the system file designated by file handle FH for writing - cases from dictionary D according to the given OPTS. If - COMPRESS is nonzero, the system file will be compressed. + cases from dictionary D according to the given OPTS. No reference to D is retained, so it may be modified or destroyed at will after this function returns. D is not @@ -216,7 +215,7 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d, &w->file, NULL); if (w->rf == NULL) { - msg (ME, _("Error opening \"%s\" for writing as a system file: %s."), + msg (ME, _("Error opening `%s' for writing as a system file: %s."), fh_get_file_name (fh), strerror (errno)); goto error; } @@ -269,10 +268,7 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d, write_int (w, 0); if (write_error (w)) - { - close_writer (w); - return NULL; - } + goto error; return casewriter_create (dict_get_proto (d), &sys_file_casewriter_class, w); @@ -947,7 +943,7 @@ sys_file_casewriter_destroy (struct casewriter *writer, void *w_) } /* Returns true if an I/O error has occurred on WRITER, false otherwise. */ -bool +static bool write_error (const struct sfm_writer *writer) { return ferror (writer->file); @@ -955,7 +951,7 @@ write_error (const struct sfm_writer *writer) /* Closes a system file after we're done with it. Returns true if successful, false if an I/O error occurred. */ -bool +static bool close_writer (struct sfm_writer *w) { bool ok; @@ -986,7 +982,7 @@ close_writer (struct sfm_writer *w) ok = false; if (!ok) - msg (ME, _("An I/O error occurred writing system file \"%s\"."), + msg (ME, _("An I/O error occurred writing system file `%s'."), fh_get_file_name (w->fh)); if (ok ? !replace_file_commit (w->rf) : !replace_file_abort (w->rf))