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++)
if (tv_is_ge (tv, &ts->thresh))
{
char **sfx;
--
1.7.10.4