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);