From f511840646b9e21deffb4b79a63d8f4ae48315c7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 15 Feb 2009 16:49:35 +0100 Subject: find: avoid warning about unused local, remove unnecessary include. * find/pred.c (scan_for_digit_differences): Remove declaration of unused local, "ok". (do_time_format): Remove decl of "done"; replace sole use with a constant, "true". Initialize "i" and "n". * lib/dircallback.c: Don't include unistd.h. Not needed. --- ChangeLog | 8 ++++++++ find/pred.c | 5 ++--- lib/dircallback.c | 7 +------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91b00722..291116f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,14 @@ 2009-04-10 Jim Meyering + Backport a fix from 4.5.x. + find: avoid warning about unused local, remove unnecessary include. + * find/pred.c (scan_for_digit_differences): Remove declaration of + unused local, "ok". + (do_time_format): Remove decl of "done"; replace sole use with a + constant, "true". Initialize "i" and "n". + * lib/dircallback.c: Don't include unistd.h. Not needed. + Backport a fix from 4.5.x. * README-CVS: tiny typo fix (s/fileutils/findutils/). diff --git a/find/pred.c b/find/pred.c index 92da9fc2..b4e04047 100644 --- a/find/pred.c +++ b/find/pred.c @@ -2070,7 +2070,6 @@ do_time_format (const char *fmt, const struct tm *p, const char *ns, size_t ns_s static char *buf = NULL; static size_t buf_size; char *timefmt = NULL; - boolean done = false; struct tm altered_time; @@ -2098,7 +2097,7 @@ do_time_format (const char *fmt, const struct tm *p, const char *ns, size_t ns_s */ buf_size = 1u; buf = xmalloc (buf_size); - while (!done) + while (true) { /* I'm not sure that Solaris will return 0 when the buffer is too small. * Therefore we do not check for (buf_used != 0) as the termination @@ -2109,7 +2108,7 @@ do_time_format (const char *fmt, const struct tm *p, const char *ns, size_t ns_s && (buf_used < buf_size)) /* Solaris workaround */ { char *altbuf; - size_t i, n; + size_t i = 0, n = 0; size_t final_len = (buf_used + 1u /* for \0 */ + ns_size); diff --git a/lib/dircallback.c b/lib/dircallback.c index 29fb276c..5dbf3b3b 100644 --- a/lib/dircallback.c +++ b/lib/dircallback.c @@ -1,5 +1,5 @@ /* listfile.c -- run a function in a specific directory - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,11 +32,6 @@ #include "save-cwd.h" -/* The presence of unistd.h is assumed by gnulib these days, so we - * might as well assume it too. - */ -#include /* for readlink() */ - #ifdef HAVE_LOCALE_H #include #endif -- cgit v1.2.1