From: Fabian Keil Date: Wed, 11 Apr 2007 10:55:44 +0000 (+0000) Subject: Enforce some assertions that could be triggered X-Git-Tag: v_3_0_7~280 X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/faq/%22https:/@default-cgi@show-url-info?a=commitdiff_plain;h=99d6be98182dd4cac086c5dbcf3341befe1fd84e;p=privoxy.git Enforce some assertions that could be triggered on mingw32 and other systems where we use threads but no locks. --- diff --git a/errlog.c b/errlog.c index f87d1ba4..9b9fd500 100644 --- a/errlog.c +++ b/errlog.c @@ -1,4 +1,4 @@ -const char errlog_rcs[] = "$Id: errlog.c,v 1.48 2007/03/31 13:33:28 fabiankeil Exp $"; +const char errlog_rcs[] = "$Id: errlog.c,v 1.49 2007/04/08 16:44:15 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/errlog.c,v $ @@ -33,6 +33,9 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.48 2007/03/31 13:33:28 fabiankeil E * * Revisions : * $Log: errlog.c,v $ + * Revision 1.49 2007/04/08 16:44:15 fabiankeil + * We need for gettimeofday(), not . + * * Revision 1.48 2007/03/31 13:33:28 fabiankeil * Add alternative log_error() with timestamps * that contain milliseconds and without using @@ -803,8 +806,8 @@ void log_error(int loglevel, const char *fmt, ...) outbuf = outbuf_save; /* - * Memsetting the whole buffer to zero - * here make things easier later on. + * Memsetting the whole buffer to zero (in theory) + * makes things easier later on. */ memset(outbuf, 0, log_buffer_size); @@ -833,10 +836,15 @@ void log_error(int loglevel, const char *fmt, ...) if (ch != '%') { outbuf[length++] = ch; - assert(outbuf[length] == '\0'); + /* + * XXX: Only necessary on platforms which don't use pthread + * mutexes (mingw32 for example), where multiple threads can + * write to the buffer at the same time. + */ + outbuf[length] = '\0'; continue; } - assert(outbuf[length] == '\0'); + outbuf[length] = '\0'; ch = *src++; switch (ch) { case '%':