[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
3 patches: avoid warnings, unnecessary include
From: |
Jim Meyering |
Subject: |
3 patches: avoid warnings, unnecessary include |
Date: |
Sun, 15 Feb 2009 16:49:35 +0100 |
Hi,
Here are three tiny patches.
>From 4af19b0784919915be4341b9917192c0d7dd232e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 11 Jan 2009 19:32:29 +0100
Subject: [PATCH 1/3] find: avoid warning about unused local
* find/pred.c (scan_for_digit_differences):
Remove declaration of unused local, "ok".
---
find/pred.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/find/pred.c b/find/pred.c
index a458803..43bebc2 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -1,6 +1,6 @@
/* pred.c -- execute the expression tree.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 2000, 2003,
- 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 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
@@ -2023,7 +2023,6 @@ static boolean
scan_for_digit_differences(const char *p, const char *q,
size_t *first, size_t *n)
{
- bool ok = true;
bool seen = false;
size_t i;
--
1.6.2.rc0.238.g7a114
>From ae23bd577330ba29ef900fe459add31324aaf9a2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 15 Feb 2009 08:48:07 +0100
Subject: [PATCH 2/3] avoid bogus warning about may be used uninitialized
* find/pred.c (do_time_format): Remove decl of "done"; replace sole
use with a constant, "true".
Initialize "i" and "n".
---
find/pred.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/find/pred.c b/find/pred.c
index 43bebc2..fc70ae4 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -2069,7 +2069,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;
@@ -2097,7 +2096,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
@@ -2108,7 +2107,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);
--
1.6.2.rc0.238.g7a114
>From 603b8c3046c7e30b2c54e36fb1ff23bf9d76c442 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 15 Feb 2009 15:23:07 +0100
Subject: [PATCH 3/3] * lib/dircallback.c: Don't include unistd.h. Not needed.
---
lib/dircallback.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/lib/dircallback.c b/lib/dircallback.c
index ca282dd..3d48d26 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 <unistd.h> /* for readlink() */
-
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
--
1.6.2.rc0.238.g7a114
- 3 patches: avoid warnings, unnecessary include,
Jim Meyering <=