diff options
author | James Youngman <jay@gnu.org> | 2011-06-15 23:24:04 +0100 |
---|---|---|
committer | James Youngman <jay@gnu.org> | 2011-06-18 20:04:09 +0100 |
commit | d8260ba1e0729ad27f0fc5d857431a8babb266c6 (patch) | |
tree | 16e343d57bb423d11498da56e3b472e746cdc4bf | |
parent | e71e4662da776e1f4298b35b75660031a1eb7f16 (diff) | |
download | findutils-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-- | ChangeLog | 6 | ||||
-rw-r--r-- | find/parser.c | 24 | ||||
-rw-r--r-- | lib/regextype.c | 4 |
3 files changed, 20 insertions, 14 deletions
@@ -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[] = |