mess_buffer[0] = '\0';
}
+void cleanup_mess_buffer()
+{
+ if (mess_buffer)
+ free(mess_buffer);
+}
+
void init_mess_buffer()
{
if (mess_buffer == NULL) {
if (mess_buffer) {
mess_buffer[0] = '\0';
bufsize = INITIAL_BUF_SIZE;
+ if (atexit(cleanup_mess_buffer) != 0)
+ gedcom_warning(_("Could not register buffer cleanup function"));
}
else {
fprintf(stderr, _("Could not allocate memory at %s, %d"),
va_list ap;
reset_mess_buffer();
- safe_buf_append(_("Warning on line %d: "), line_no);
+ if (line_no != 0)
+ safe_buf_append(_("Warning on line %d: "), line_no);
+ else
+ safe_buf_append(_("Warning: "));
va_start(ap, s);
res = safe_buf_vappend(s, ap);
va_end(ap);
va_list ap;
reset_mess_buffer();
- safe_buf_append(_("Error on line %d: "), line_no);
+ if (line_no != 0)
+ safe_buf_append(_("Error on line %d: "), line_no);
+ else
+ safe_buf_append(_("Error: "));
va_start(ap, s);
res = safe_buf_vappend(s, ap);
va_end(ap);