new_msg = xmemdup (m, sizeof *m);
if (m->file_name != NULL)
new_msg->file_name = xstrdup (m->file_name);
+ if (m->command_name != NULL)
+ new_msg->command_name = xstrdup (m->command_name);
new_msg->text = xstrdup (m->text);
return new_msg;
{
free (m->file_name);
free (m->text);
+ free (m->command_name);
free (m);
}
char *
-msg_to_string (const struct msg *m, const char *command_name)
+msg_to_string (const struct msg *m)
{
struct string s;
ds_put_format (&s, "%s: ", msg_severity_to_string (m->severity));
- if (m->category == MSG_C_SYNTAX && command_name != NULL)
- ds_put_format (&s, "%s: ", command_name);
+ if (m->category == MSG_C_SYNTAX && m->command_name != NULL)
+ ds_put_format (&s, "%s: ", m->command_name);
ds_put_cstr (&s, m->text);
process_msg (m);
free (m->text);
+ free (m->command_name);
}
/* Disables message output until the next call to msg_enable. If