Author: wollman Date: Wed Nov 25 04:35:54 2009 New Revision: 199783 URL: http://svn.freebsd.org/changeset/base/199783
Log: Make all three if conditions look similar by always initializing nsec and moving the default initialization of prec into the else clause. The clang static analyzer erroneously thought that nsec can be used uninitialized here; it was not actually possible, but better to make the code clearer. (Clang can't know that sprintf() won't modify *pi behind the scenes.) Modified: head/lib/libc/stdio/xprintf_time.c Modified: head/lib/libc/stdio/xprintf_time.c ============================================================================== --- head/lib/libc/stdio/xprintf_time.c Wed Nov 25 04:27:55 2009 (r199782) +++ head/lib/libc/stdio/xprintf_time.c Wed Nov 25 04:35:54 2009 (r199783) @@ -64,7 +64,6 @@ __printf_render_time(struct __printf_io intmax_t t, tx; int i, prec, nsec; - prec = 0; if (pi->is_long) { tv = *((struct timeval **)arg[0]); t = tv->tv_sec; @@ -78,6 +77,8 @@ __printf_render_time(struct __printf_io } else { tp = *((time_t **)arg[0]); t = *tp; + nsec = 0; + prec = 0; } p = buf; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"