[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 10/12] libshouldbeinlibc: fix dead initialization in fmt_name
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 10/12] libshouldbeinlibc: fix dead initialization in fmt_named_interval |
Date: |
Wed, 20 Nov 2013 23:59:18 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Wed 20 Nov 2013 14:38:03 +0100, a écrit :
> Found using the Clang Static Analyzer.
>
> * libshouldbeinlibc/timefmt.c (fmt_named_interval): Fix dead
> initialization by declaring ts in the loop.
> ---
> libshouldbeinlibc/timefmt.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libshouldbeinlibc/timefmt.c b/libshouldbeinlibc/timefmt.c
> index a28f58b..2002770 100644
> --- a/libshouldbeinlibc/timefmt.c
> +++ b/libshouldbeinlibc/timefmt.c
> @@ -105,12 +105,11 @@ fmt_named_interval (struct timeval *tv, size_t width,
> {{0, 1}, {0, 1}, {0, 0}, {" microsecond", "us", 0 }},
> {{0, 0} }
> };
> - struct tscale *ts = time_scales;
>
> if (width <= 0 || width >= buf_len)
> width = buf_len - 1;
>
> - for (ts = time_scales; !tv_is_zero (&ts->thresh); ts++)
> + for (struct tscale *ts = time_scales; !tv_is_zero (&ts->thresh); ts++)
C99 for index declaration is not usual in our source code, do we start
using it?
> if (tv_is_ge (tv, &ts->thresh))
> {
> char **sfx;
> --
> 1.7.10.4
>
--
Samuel
<N> (* If you have a precise idea of the intended use of the following code,
please
<N> write to Eduardo.Gimenez@inria.fr and ask for the prize :-)
<N> -- Eduardo (11/8/97) *)
-+- N sur #ens-mim - et c'était un des développeurs -+-
- Re: [PATCH 06/12] fatfs: fix error handling in diskfs_get_directs, (continued)
- [PATCH 07/12] ftpfs: fix error handling in refresh_dir, Justus Winter, 2013/11/20
- [PATCH 12/12] libshouldbeinlibc: fix error handling in maptime_map, Justus Winter, 2013/11/20
- [PATCH 09/12] usermux: actually use the computed flags value in netfs_attempt_utimes, Justus Winter, 2013/11/20
- [PATCH 08/12] nfsd: fix error handling in op_remove, Justus Winter, 2013/11/20
- [PATCH 10/12] libshouldbeinlibc: fix dead initialization in fmt_named_interval, Justus Winter, 2013/11/20
- Re: [PATCH 10/12] libshouldbeinlibc: fix dead initialization in fmt_named_interval,
Samuel Thibault <=
- [PATCH 11/12] mach-defpager: drop all register qualifiers, Justus Winter, 2013/11/20