Added casereader_clone function.
[pspp-builds.git] / src / language / data-io / get.c
index 651d222af9745684a337c7c29d7bc242660f6753..2bb463113c4fcff8d4b49d0dd7aba8818512c3bd 100644 (file)
@@ -27,6 +27,7 @@
 #include <data/case-source.h>
 #include <data/case.h>
 #include <data/casefile.h>
+#include <data/fastfile.h>
 #include <data/dictionary.h>
 #include <data/por-file-writer.h>
 #include <data/procedure.h>
@@ -41,6 +42,7 @@
 #include <language/lexer/lexer.h>
 #include <language/lexer/variable-parser.h>
 #include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
 #include <libpspp/compiler.h>
 #include <libpspp/hash.h>
 #include <libpspp/message.h>
@@ -440,6 +442,8 @@ parse_write_command (enum writer_type writer_type,
     }
   else
     aw->writer = any_writer_open (handle, dict);
+  if (aw->writer == NULL)
+    goto error;
   dict_destroy (dict);
   
   return aw;
@@ -538,7 +542,7 @@ parse_output_trns (enum writer_type writer_type)
 
 /* Writes case C to the system file specified on XSAVE or XEXPORT. */
 static int
-output_trns_proc (void *trns_, struct ccase *c, int case_num UNUSED)
+output_trns_proc (void *trns_, struct ccase *c, casenum_t case_num UNUSED)
 {
   struct output_trns *t = trns_;
   case_writer_write_case (t->aw, c);
@@ -841,7 +845,7 @@ cmd_match_files (void)
           saw_table = true;
         }
       else
-        assert (0);
+        NOT_REACHED ();
       lex_match ('=');
 
       file->by = NULL;
@@ -1123,7 +1127,7 @@ cmd_match_files (void)
     discard_variables ();
 
   dict_compact_values (mtf.dict);
-  mtf.output = casefile_create (dict_get_next_value_idx (mtf.dict));
+  mtf.output = fastfile_create (dict_get_next_value_idx (mtf.dict));
   mtf.seq_nums = xcalloc (dict_get_var_cnt (mtf.dict), sizeof *mtf.seq_nums);
   case_create (&mtf.mtf_case, dict_get_next_value_idx (mtf.dict));
 
@@ -1167,7 +1171,7 @@ mtf_processing_finish (void *mtf_)
     if (iter->handle == NULL)
       {
         if (!mtf_delete_file_in_place (mtf, &iter))
-          abort ();
+          NOT_REACHED ();
         break;
       }