1 /*****************************************************************************
2 * This file is part of gfxprim library. *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
19 * Copyright (C) 2009-2012 Cyril Hrubis <metan@ucw.cz> *
21 *****************************************************************************/
32 void tst_msg_clear(struct tst_msg_store
*self
)
34 struct tst_msg
*msg
, *prev
= NULL
;
36 for (msg
= self
->first
; msg
!= NULL
; msg
= msg
->next
) {
47 int tst_msg_append(struct tst_msg_store
*self
, int type
, const char *msg_text
)
49 size_t len
= strlen(msg_text
);
52 msg
= malloc(sizeof(struct tst_msg
) + len
+ 1);
55 tst_warn("tst_msg: malloc() failed: %s", strerror(errno
));
61 strcpy(msg
->msg
, msg_text
);
63 if (self
->last
== NULL
) {
67 self
->last
->next
= msg
;
74 static char type_to_char(enum tst_report_type type
)
88 void tst_msg_print(const struct tst_msg_store
*self
)
92 for (msg
= self
->first
; msg
!= NULL
; msg
= msg
->next
)
93 fprintf(stderr
, "%c: %s\n", type_to_char(msg
->type
), msg
->msg
);