Clean up file handle code in preparation to add temporary file
[pspp] / src / sysfile-info.c
index 45bffad762d22c03ce38434b757772ad5040931c..a9f074ab3be2ae6838f76ddd42afe1298fbf0d88 100644 (file)
@@ -29,6 +29,7 @@
 #include "file-handle.h"
 #include "hash.h"
 #include "lexer.h"
+#include "magic.h"
 #include "misc.h"
 #include "output.h"
 #include "sfm-read.h"
@@ -97,7 +98,7 @@ cmd_sysfile_info (void)
   t = tab_create (2, 9, 0);
   tab_vline (t, TAL_1 | TAL_SPACING, 1, 0, 8);
   tab_text (t, 0, 0, TAB_LEFT, _("File:"));
-  tab_text (t, 1, 0, TAB_LEFT, handle_get_filename (h));
+  tab_text (t, 1, 0, TAB_LEFT, fh_get_filename (h));
   tab_text (t, 0, 1, TAB_LEFT, _("Label:"));
   {
     const char *label = dict_get_label (d);
@@ -171,7 +172,7 @@ cmd_sysfile_info (void)
 
 static void display_macros (void);
 static void display_documents (void);
-static void display_variables (struct variable **, int, int);
+static void display_variables (struct variable **, size_t, int);
 static void display_vectors (int sorted);
 
 int
@@ -181,7 +182,7 @@ cmd_display (void)
   int sorted;
 
   /* Variables to display. */
-  int n;
+  size_t n;
   struct variable **vl;
 
   if (lex_match_id ("MACROS"))
@@ -247,7 +248,7 @@ cmd_display (void)
 
       if (as == AS_SCRATCH)
        {
-         int i, m;
+         size_t i, m;
          for (i = 0, m = n; i < n; i++)
            if (dict_class_from_id (vl[i]->name) != DC_SCRATCH)
              {
@@ -341,7 +342,7 @@ variables_dim (struct tab_table *t, struct outp_driver *d)
 }
   
 static void
-display_variables (struct variable **vl, int n, int as)
+display_variables (struct variable **vl, size_t n, int as)
 {
   struct variable **vp = vl;           /* Variable pointer. */
   struct tab_table *t;
@@ -349,7 +350,7 @@ display_variables (struct variable **vl, int n, int as)
   int nr;                      /* Number of rows. */
   int pc;                      /* `Position column' */
   int r;                       /* Current row. */
-  int i;
+  size_t i;
 
   _as = as;
   switch (as)
@@ -575,7 +576,7 @@ display_vectors (int sorted)
       return;
     }
 
-  vl = xmalloc (sizeof *vl * nvec);
+  vl = xnmalloc (nvec, sizeof *vl);
   for (i = 0; i < nvec; i++)
     vl[i] = dict_get_vector (default_dict, i);
   if (sorted)