summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Youngman <jay@gnu.org>2011-06-15 23:24:04 +0100
committerJames Youngman <jay@gnu.org>2011-06-18 20:04:09 +0100
commitd8260ba1e0729ad27f0fc5d857431a8babb266c6 (patch)
tree16e343d57bb423d11498da56e3b472e746cdc4bf
parente71e4662da776e1f4298b35b75660031a1eb7f16 (diff)
downloadfindutils-d8260ba1e0729ad27f0fc5d857431a8babb266c6.tar.gz
Fix compiler warnings in lib/regextype.c and find/parser.c.
* lib/regextype.c (tagRegexTypeMap): make the name field const. * find/parser.c (parse_version): instead of counting features, use a boolean variable, nofeatures. This avoids compiler warnings about overflow.
-rw-r--r--ChangeLog6
-rw-r--r--find/parser.c24
-rw-r--r--lib/regextype.c4
3 files changed, 20 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 3cc9dc0b..0fdcf460 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2011-06-15 James Youngman <jay@gnu.org>
+ Fix compiler warnings in lib/regextype.c and find/parser.c.
+ * lib/regextype.c (tagRegexTypeMap): make the name field const.
+ * find/parser.c (parse_version): instead of counting features, use
+ a boolean variable, nofeatures. This avoids compiler warnings
+ about overflow.
+
Adopt the use of the manywarnings module.
* import-gnulib.config (modules): Add manywarnings.
* configure.ac: Invoke gl_MANYWARN_ALL_GCC and
diff --git a/find/parser.c b/find/parser.c
index 2d462c80..d1ee52ad 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2691,7 +2691,7 @@ parse_user (const struct parser_table* entry, char **argv, int *arg_ptr)
static bool
parse_version (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- int features = 0;
+ bool has_features = false;
int flags;
(void) argv;
@@ -2703,33 +2703,33 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr)
#if CACHE_IDS
printf ("CACHE_IDS ");
- ++features;
+ has_features = true;
#endif
#if DEBUG
printf ("DEBUG ");
- ++features;
+ has_features = true;
#endif
#if DEBUG_STAT
printf ("DEBUG_STAT ");
- ++features;
+ has_features = true;
#endif
#if defined HAVE_STRUCT_DIRENT_D_TYPE
printf ("D_TYPE ");
- ++features;
+ has_features = true;
#endif
#if defined O_NOFOLLOW
printf ("O_NOFOLLOW(%s) ",
(options.open_nofollow_available ? "enabled" : "disabled"));
- ++features;
+ has_features = true;
#endif
#if defined LEAF_OPTIMISATION
printf ("LEAF_OPTIMISATION ");
- ++features;
+ has_features = true;
#endif
if (0 < is_selinux_enabled ())
{
printf ("SELINUX ");
- ++features;
+ has_features = true;
}
flags = 0;
@@ -2737,7 +2737,7 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr)
{
int nflags = 0;
printf ("FTS(");
- ++features;
+ has_features = true;
if (flags & FTS_CWDFD)
{
@@ -2746,15 +2746,15 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr)
printf (",");
}
printf ("FTS_CWDFD");
- ++nflags;
+ has_features = true;
}
printf (") ");
}
printf ("CBO(level=%d) ", (int)(options.optimisation_level));
- ++features;
+ has_features = true;
- if (0 == features)
+ if (!has_features)
{
/* For the moment, leave this as English in case someone wants
to parse these strings. */
diff --git a/lib/regextype.c b/lib/regextype.c
index d89f3757..efc06099 100644
--- a/lib/regextype.c
+++ b/lib/regextype.c
@@ -49,9 +49,9 @@
struct tagRegexTypeMap
{
- char *name;
+ const char *name;
int context;
- int option_val;
+ int option_val;
};
struct tagRegexTypeMap regex_map[] =