Reworked settings so as to use one large struct instead of lots of static
[pspp-builds.git] / src / language / stats / flip.c
index f327adec9a61d35a530721be689658971676335a..ccb84dd8a4f37abecb352a2bf04dc92f95b71602 100644 (file)
@@ -21,9 +21,6 @@
 #include <float.h>
 #include <limits.h>
 #include <stdlib.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
 
 #include <data/case.h>
 #include <data/casereader.h>
 #include <data/dictionary.h>
 #include <data/procedure.h>
 #include <data/settings.h>
+#include <data/short-names.h>
 #include <data/value.h>
 #include <data/variable.h>
 #include <language/command.h>
 #include <language/lexer/lexer.h>
 #include <language/lexer/variable-parser.h>
-#include <libpspp/alloc.h>
 #include <libpspp/array.h>
 #include <libpspp/assertion.h>
 #include <libpspp/message.h>
@@ -46,6 +43,7 @@
 
 #include "intprops.h"
 #include "minmax.h"
+#include "xalloc.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -120,7 +118,7 @@ cmd_flip (struct lexer *lexer, struct dataset *ds)
       lex_match (lexer, '/');
     }
   else
-    dict_get_vars (dict, &flip->var, &flip->var_cnt, 1u << DC_SYSTEM);
+    dict_get_vars (dict, &flip->var, &flip->var_cnt, DC_SYSTEM);
   pool_register (flip->pool, free, flip->var);
 
   lex_match (lexer, '/');
@@ -364,7 +362,7 @@ flip_file (struct flip_pgm *flip)
 
   /* Allocate memory for many cases. */
   case_bytes = flip->var_cnt * sizeof *input_buf;
-  case_capacity = get_workspace () / case_bytes;
+  case_capacity = settings_get_workspace () / case_bytes;
   if (case_capacity > flip->case_cnt * 2)
     case_capacity = flip->case_cnt * 2;
   if (case_capacity < 2)
@@ -426,14 +424,6 @@ flip_file (struct flip_pgm *flip)
          for (j = 0; j < read_cases; j++)
            output_buf[j] = input_buf[i + j * flip->var_cnt];
 
-#ifndef HAVE_FSEEKO
-#define fseeko fseek
-#endif
-
-#ifndef HAVE_OFF_T
-#define off_t long int
-#endif
-
          if (fseeko (output_file,
                       sizeof *input_buf * (case_idx
                                            + (off_t) i * flip->case_cnt),