X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ucw%2Flog.c;h=cf5d115ad78ee9aae4dd25e9f370fb3e0f5335e6;hb=f17e4350dcf0c033891e52b30b0c32a4a4fed5e0;hp=419c5e9fcca30ef741f625b8ee7bf769894ea25f;hpb=53e1f544385cb04b518b64facd56a653c286a85b;p=libucw.git diff --git a/ucw/log.c b/ucw/log.c index 419c5e9f..cf5d115a 100644 --- a/ucw/log.c +++ b/ucw/log.c @@ -8,10 +8,10 @@ * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" -#include "ucw/log.h" -#include "ucw/log-internal.h" -#include "ucw/simple-lists.h" +#include +#include +#include +#include #include #include @@ -45,8 +45,10 @@ struct log_stream log_stream_default = { .types = ~0U, .msgfmt = LSFMT_DEFAULT, // an empty clist - .substreams.head.next = (cnode *) &log_stream_default.substreams.head, - .substreams.head.prev = (cnode *) &log_stream_default.substreams.head, + .substreams.head = { + .next = (cnode *) &log_stream_default.substreams.head, + .prev = (cnode *) &log_stream_default.substreams.head, + }, }; /*** Registry of streams and their identifiers ***/ @@ -153,7 +155,7 @@ vmsg(uns cat, const char *fmt, va_list args) p = m.raw_msg; while (*p) { - if (*p < 0x20 && *p != '\t') + if (*p >= 0 && *p < 0x20 && *p != '\t') *p = 0x7f; p++; } @@ -340,18 +342,22 @@ do_die(void) } void -die(const char *fmt, ...) +vdie(const char *fmt, va_list args) { - va_list args; - - va_start(args, fmt); vmsg(L_FATAL, fmt, args); - va_end(args); if (log_die_hook) log_die_hook(); do_die(); } +void +die(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vdie(fmt, args); +} + void assert_failed(const char *assertion, const char *file, int line) {