Added fh_free function.
[pspp] / src / pfm-read.c
index 24f9283379dd1b44d98b2e00f2e73e9488321b48..3dd939ddae25dc1564eefba3fb410e09bbeb8416 100644 (file)
@@ -82,7 +82,7 @@ error (struct pfm_reader *r, const char *msg, ...)
 
   e.class = ME;
   getl_location (&e.where.filename, &e.where.line_number);
-  filename = handle_get_filename (r->fh);
+  filename = fh_get_filename (r->fh);
   e.title = title = pool_alloc (r->pool, strlen (filename) + 80);
   sprintf (title, _("portable file %s corrupt at offset %ld: "),
            filename, ftell (r->file));
@@ -159,7 +159,7 @@ pfm_open_reader (struct file_handle *fh, struct dictionary **dict,
   if (setjmp (r->bail_out))
     goto error;
   r->fh = fh;
-  r->file = pool_fopen (r->pool, handle_get_filename (r->fh), "rb");
+  r->file = pool_fopen (r->pool, fh_get_filename (r->fh), "rb");
   r->weight_index = -1;
   r->trans = NULL;
   r->var_cnt = 0;
@@ -171,7 +171,7 @@ pfm_open_reader (struct file_handle *fh, struct dictionary **dict,
     {
       msg (ME, _("An error occurred while opening \"%s\" for reading "
                  "as a portable file: %s."),
-           handle_get_filename (r->fh), strerror (errno));
+           fh_get_filename (r->fh), strerror (errno));
       err_cond_fail ();
       goto error;
     }
@@ -400,7 +400,7 @@ read_header (struct pfm_reader *r)
   for (i = 0; i < 8; i++) 
     if (!match (r, "SPSSPORT"[i])) 
       {
-        msg (SE, _("%s: Not a portable file."), handle_get_filename (r->fh));
+        msg (SE, _("%s: Not a portable file."), fh_get_filename (r->fh));
         longjmp (r->bail_out, 1);
       }
 }
@@ -492,7 +492,7 @@ read_variables (struct pfm_reader *r, struct dictionary *dict)
   r->var_cnt = read_int (r);
   if (r->var_cnt <= 0 || r->var_cnt == NOT_INT)
     error (r, _("Invalid number of variables %d."), r->var_cnt);
-  r->widths = pool_alloc (r->pool, sizeof *r->widths * r->var_cnt);
+  r->widths = pool_nalloc (r->pool, r->var_cnt, sizeof *r->widths);
 
   /* Purpose of this value is unknown.  It is typically 161. */
   read_int (r);
@@ -608,7 +608,7 @@ read_value_label (struct pfm_reader *r, struct dictionary *dict)
   int i;
 
   nv = read_int (r);
-  v = pool_alloc (r->pool, sizeof *v * nv);
+  v = pool_nalloc (r->pool, nv, sizeof *v);
   for (i = 0; i < nv; i++)
     {
       char name[256];