diff options
author | Garrett Wollman <wollman@FreeBSD.org> | 2009-11-25 04:35:54 +0000 |
---|---|---|
committer | Garrett Wollman <wollman@FreeBSD.org> | 2009-11-25 04:35:54 +0000 |
commit | 750a395ba6d87693b16041db60bf6a0f52695f8f (patch) | |
tree | 00513fdd94aac916df0e6c0489245d8cda7940cb /lib | |
parent | ab5b2fafecf8a2abd3def2018459393046992df4 (diff) | |
download | src-750a395ba6d87693b16041db60bf6a0f52695f8f.tar.gz src-750a395ba6d87693b16041db60bf6a0f52695f8f.zip |
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.)
Notes
Notes:
svn path=/head/; revision=199783
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdio/xprintf_time.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdio/xprintf_time.c b/lib/libc/stdio/xprintf_time.c index 81697f165a43..9d732fe4f415 100644 --- a/lib/libc/stdio/xprintf_time.c +++ b/lib/libc/stdio/xprintf_time.c @@ -64,7 +64,6 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const 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 *io, const struct printf_info *pi, const } else { tp = *((time_t **)arg[0]); t = *tp; + nsec = 0; + prec = 0; } p = buf; |