format: Make fmt_number_style_init(), fmt_number_style_destroy() static.
[pspp] / src / data / sys-file-writer.c
index 729213bf6826337ba2a73c2c6ae6ce7ed678d7da..ac5f4c903ed0266a4e50bc87a43c9b29e177cf9e 100644 (file)
@@ -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
@@ -209,9 +208,9 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d,
     goto error;
 
   /* Create the file on disk. */
-  mode = S_IRUSR | S_IRGRP | S_IROTH;
+  mode = 0444;
   if (opts.create_writeable)
-    mode |= S_IWUSR | S_IWGRP | S_IWOTH;
+    mode |= 0222;
   w->rf = replace_file_start (fh_get_file_name (fh), "wb", mode,
                               &w->file, NULL);
   if (w->rf == NULL)
@@ -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;