diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-09-08 20:41:44 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-09-08 20:48:44 -0700 |
commit | c383c570c67e0ede0d3aa0ce08961d5745e7764d (patch) | |
tree | dd317d4b4e860df3518ee1cf48852ec3609a21b6 | |
parent | 8defcee49be881f8c7b8327f07b988fbe5c7171d (diff) | |
download | coreutils-c383c570c67e0ede0d3aa0ce08961d5745e7764d.tar.xz |
maint: avoid file-scope names of the form _[a-z]*
The C standard says this isn't portable, if you include
standard include files.
* build-aux/gen-single-binary.sh:
* src/coreutils-arch.c (single_binary_main_arch)
(single_binary_main_uname):
* src/coreutils-dir.c (single_binary_main_ls)
(_single_binary_main_dir):
* src/coreutils-vdir.c (single_binary_main_ls)
(_single_binary_main_vdir):
* src/coreutils.c (SINGLE_BINARY_PROGRAM):
Remove leading _ from single_binary prefix.
* src/numfmt.c (round_style): Rename from _round. All uses changed.
(inval_style): Rename from _invalid. All uses changed.
-rwxr-xr-x | build-aux/gen-single-binary.sh | 6 | ||||
-rw-r--r-- | src/coreutils-arch.c | 8 | ||||
-rw-r--r-- | src/coreutils-dir.c | 8 | ||||
-rw-r--r-- | src/coreutils-vdir.c | 8 | ||||
-rw-r--r-- | src/coreutils.c | 4 | ||||
-rw-r--r-- | src/numfmt.c | 26 |
6 files changed, 31 insertions, 29 deletions
diff --git a/build-aux/gen-single-binary.sh b/build-aux/gen-single-binary.sh index 1128f40c6..4e07cfdaa 100755 --- a/build-aux/gen-single-binary.sh +++ b/build-aux/gen-single-binary.sh @@ -90,9 +90,9 @@ for cmd in $ALL_PROGRAMS; do # CFLAGS # Hack any other program defining a main() replacing its main by - # _single_binary_main_$PROGRAM_NAME. - echo "${base}_CFLAGS = \"-Dmain=_single_binary_main_${cmd} (int, char **);" \ - " int _single_binary_main_${cmd}\" " \ + # single_binary_main_$PROGRAM_NAME. + echo "${base}_CFLAGS = \"-Dmain=single_binary_main_${cmd} (int, char **);" \ + " int single_binary_main_${cmd}\" " \ "-Dusage=_usage_${cmd} \$(src_coreutils_CFLAGS)" var=src_${cmd}_CFLAGS eval "value=\$$var" diff --git a/src/coreutils-arch.c b/src/coreutils-arch.c index f55bef9d9..66e49909d 100644 --- a/src/coreutils-arch.c +++ b/src/coreutils-arch.c @@ -22,12 +22,12 @@ #include "uname.h" /* Ensure that the main for uname is declared even if the tool is not being built in this single-binary. */ -int _single_binary_main_uname (int argc, char **argv); -int _single_binary_main_arch (int argc, char **argv); +int single_binary_main_uname (int argc, char **argv); +int single_binary_main_arch (int argc, char **argv); int -_single_binary_main_arch (int argc, char **argv) +single_binary_main_arch (int argc, char **argv) { uname_mode = UNAME_ARCH; - return _single_binary_main_uname (argc, argv); + return single_binary_main_uname (argc, argv); } diff --git a/src/coreutils-dir.c b/src/coreutils-dir.c index afbe39a50..4543cb414 100644 --- a/src/coreutils-dir.c +++ b/src/coreutils-dir.c @@ -22,12 +22,12 @@ #include "ls.h" /* Ensure that the main for ls is declared even if the tool is not being built in this single-binary. */ -int _single_binary_main_ls (int argc, char **argv); -int _single_binary_main_dir (int argc, char **argv); +int single_binary_main_ls (int argc, char **argv); +int single_binary_main_dir (int argc, char **argv); int -_single_binary_main_dir (int argc, char **argv) +single_binary_main_dir (int argc, char **argv) { ls_mode = LS_MULTI_COL; - return _single_binary_main_ls (argc, argv); + return single_binary_main_ls (argc, argv); } diff --git a/src/coreutils-vdir.c b/src/coreutils-vdir.c index b1b0194ee..223f70cef 100644 --- a/src/coreutils-vdir.c +++ b/src/coreutils-vdir.c @@ -22,12 +22,12 @@ #include "ls.h" /* Ensure that the main for ls is declared even if the tool is not being built in this single-binary. */ -int _single_binary_main_ls (int argc, char **argv); -int _single_binary_main_vdir (int argc, char **argv); +int single_binary_main_ls (int argc, char **argv); +int single_binary_main_vdir (int argc, char **argv); int -_single_binary_main_vdir (int argc, char** argv) +single_binary_main_vdir (int argc, char** argv) { ls_mode = LS_LONG_FORMAT; - return _single_binary_main_ls (argc, argv); + return single_binary_main_ls (argc, argv); } diff --git a/src/coreutils.c b/src/coreutils.c index 898fe8413..57dc784a8 100644 --- a/src/coreutils.c +++ b/src/coreutils.c @@ -35,7 +35,7 @@ needs to match the one passed as CFLAGS on single-binary.mk (generated by gen-single-binary.sh). */ # define SINGLE_BINARY_PROGRAM(prog_name_str, main_name) \ - int _single_binary_main_##main_name (int, char **); + int single_binary_main_##main_name (int, char **); # include "coreutils.h" # undef SINGLE_BINARY_PROGRAM #endif @@ -103,7 +103,7 @@ launch_program (const char *prog_name, int prog_argc, char **prog_argv) /* Look up the right main program. */ # define SINGLE_BINARY_PROGRAM(prog_name_str, main_name) \ else if (STREQ (prog_name_str, prog_name)) \ - prog_main = _single_binary_main_##main_name; + prog_main = single_binary_main_##main_name; # include "coreutils.h" # undef SINGLE_BINARY_PROGRAM #endif diff --git a/src/numfmt.c b/src/numfmt.c index f1113748f..ff2e41d6e 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -161,8 +161,8 @@ enum { MAX_ACCEPTABLE_DIGITS = 27 }; static enum scale_type scale_from = scale_none; static enum scale_type scale_to = scale_none; -static enum round_type _round = round_from_zero; -static enum inval_type _invalid = inval_abort; +static enum round_type round_style = round_from_zero; +static enum inval_type inval_style = inval_abort; static const char *suffix = NULL; static uintmax_t from_unit_size = 1; static uintmax_t to_unit_size = 1; @@ -677,7 +677,7 @@ simple_strtod_fatal (enum simple_strtod_error err, char const *input_str) } - if (_invalid != inval_ignore) + if (inval_style != inval_ignore) error (conv_exit_code, 0, gettext (msgid), quote (input_str)); } @@ -1077,7 +1077,7 @@ parse_human_number (const char *str, long double /*output */ *value, if (ptr && *ptr != '\0') { - if (_invalid != inval_ignore) + if (inval_style != inval_ignore) error (conv_exit_code, 0, _("invalid suffix in input %s: %s"), quote_n (0, str), quote_n (1, ptr)); e = SSE_INVALID_SUFFIX; @@ -1099,7 +1099,7 @@ prepare_padded_number (const long double val, size_t precision) expld (val, 10, &x); if (scale_to == scale_none && x > MAX_UNSCALED_DIGITS) { - if (_invalid != inval_ignore) + if (inval_style != inval_ignore) error (conv_exit_code, 0, _("value too large to be printed: '%Lg'" " (consider using --to)"), val); return 0; @@ -1107,14 +1107,14 @@ prepare_padded_number (const long double val, size_t precision) if (x > MAX_ACCEPTABLE_DIGITS - 1) { - if (_invalid != inval_ignore) + if (inval_style != inval_ignore) error (conv_exit_code, 0, _("value too large to be printed: '%Lg'" " (cannot handle values > 999Y)"), val); return 0; } double_to_human (val, precision, buf, sizeof (buf), scale_to, grouping, - _round); + round_style); if (suffix) strncat (buf, suffix, sizeof (buf) - strlen (buf) -1); @@ -1304,7 +1304,7 @@ process_line (char *line, bool newline) extract_fields (line, field, &pre, &num, &suf); if (!num) - if (_invalid != inval_ignore) + if (inval_style != inval_ignore) error (conv_exit_code, 0, _("input line is too short, " "no numbers found to convert in field %ld"), field); @@ -1390,7 +1390,7 @@ main (int argc, char **argv) break; case ROUND_OPTION: - _round = XARGMATCH ("--round", optarg, round_args, round_types); + round_style = XARGMATCH ("--round", optarg, round_args, round_types); break; case GROUPING_OPTION: @@ -1458,7 +1458,8 @@ main (int argc, char **argv) break; case INVALID_OPTION: - _invalid = XARGMATCH ("--invalid", optarg, inval_args, inval_types); + inval_style = XARGMATCH ("--invalid", optarg, + inval_args, inval_types); break; case_GETOPT_HELP_CHAR; @@ -1492,7 +1493,7 @@ main (int argc, char **argv) setup_padding_buffer (padding_width); auto_padding = (padding_width == 0 && delimiter == DELIMITER_DEFAULT); - if (_invalid != inval_abort) + if (inval_style != inval_abort) conv_exit_code = 0; if (argc > optind) @@ -1535,7 +1536,8 @@ main (int argc, char **argv) error (0, 0, _("failed to convert some of the input numbers")); int exit_status = EXIT_SUCCESS; - if (!valid_numbers && _invalid != inval_warn && _invalid != inval_ignore) + if (!valid_numbers + && inval_style != inval_warn && inval_style != inval_ignore) exit_status = EXIT_CONVERSION_WARNINGS; return exit_status; |