Get rid of capacity argument to ds_init() and update all callers.
[pspp-builds.git] / src / data / por-file-reader.c
index 0824bb311147993a0ad6795abfd654bea54f2ee9..377241ef33b861fce3b773610030cef761660d8e 100644 (file)
@@ -85,23 +85,25 @@ error (struct pfm_reader *r, const char *msg,...)
 static void
 error (struct pfm_reader *r, const char *msg, ...)
 {
-  struct error e;
-  const char *file_name;
-  char *title;
+  struct msg m;
+  struct string text;
   va_list args;
 
-  e.class = ME;
-  e.where.file_name = NULL;
-  e.where.line_number = 0;
-  file_name = fh_get_file_name (r->fh);
-  e.title = title = pool_alloc (r->pool, strlen (file_name) + 80);
-  sprintf (title, _("portable file %s corrupt at offset %ld: "),
-           file_name, ftell (r->file));
-
+  ds_init (&text);
+  ds_printf (&text, _("portable file %s corrupt at offset %ld: "),
+             fh_get_file_name (r->fh), ftell (r->file));
   va_start (args, msg);
-  err_vmsg (&e, msg, args);
+  ds_vprintf (&text, msg, args);
   va_end (args);
 
+  m.category = MSG_GENERAL;
+  m.severity = MSG_ERROR;
+  m.where.file_name = NULL;
+  m.where.line_number = 0;
+  m.text = ds_c_str (&text);
+  
+  msg_emit (&m);
+
   r->ok = false;
 
   longjmp (r->bail_out, 1);