]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
* src/cat.c (infile): Add "const" to declaration.
authorJim Meyering <jim@meyering.net>
Tue, 24 Oct 2006 23:05:30 +0000 (01:05 +0200)
committerJim Meyering <jim@meyering.net>
Tue, 24 Oct 2006 23:05:30 +0000 (01:05 +0200)
* src/csplit.c (prefix): Likewise.
* src/printf.c (cfcc_msg): Likewise.
* src/tail.c (valid_file_spec): Likewise.
* src/cut.c (cut_file): Likewise, for a parameter.
* src/expr.c (str_value): Likewise.
* src/fold.c (fold_file): Likewise.
* src/pr.c (init_header): Likewise.
* src/dircolors.c (dc_parse_stream): Likewise, for a local.
* src/tr.c (make_printable_str): Likewise.
* src/nl.c (body_type, header_type, footer_type, current_type):
(separator_str, build_type_arg, nl_file): Likewise, for many.
* src/paste.c (main): Don't assign a read-only string to 'optarg'.
* src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.

14 files changed:
ChangeLog
src/cat.c
src/csplit.c
src/cut.c
src/dircolors.c
src/expr.c
src/fold.c
src/nl.c
src/paste.c
src/pr.c
src/printf.c
src/tac.c
src/tail.c
src/tr.c

index 675b80ee6aec5b6c7056ac8aeedec6860a311dad..195ca75ef7339571092c3b08cdf98ee583d430b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-10-25  Bruno Haible  <bruno@clisp.org>
+
+       * src/cat.c (infile): Add "const" to declaration.
+       * src/csplit.c (prefix): Likewise.
+       * src/printf.c (cfcc_msg): Likewise.
+       * src/tail.c (valid_file_spec): Likewise.
+       * src/cut.c (cut_file): Likewise, for a parameter.
+       * src/expr.c (str_value): Likewise.
+       * src/fold.c (fold_file): Likewise.
+       * src/pr.c (init_header): Likewise.
+       * src/dircolors.c (dc_parse_stream): Likewise, for a local.
+       * src/tr.c (make_printable_str): Likewise.
+       * src/nl.c (body_type, header_type, footer_type, current_type):
+       (separator_str, build_type_arg, nl_file): Likewise, for many.
+       * src/paste.c (main): Don't assign a read-only string to 'optarg'.
+       * src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.
+
 2006-10-25  Jim Meyering  <jim@meyering.net>
 
        * tests/sample-test: Update copyright year list to include only
index ec2c52885a807141ae741478595f668a6731aab5..90a73c21bac1594c9426429ff467ff6615ff8ad4 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -55,7 +55,7 @@
 char *program_name;
 
 /* Name of input file.  May be "-".  */
-static char *infile;
+static char const *infile;
 
 /* Descriptor on which input file is open.  */
 static int input_desc;
index 07bcb209525ce0531f34d2384b945da37c6f85de..e174ee59ed7157ec87b2513a17eb6fa70bbcef67 100644 (file)
@@ -149,13 +149,13 @@ static uintmax_t current_line = 0;
 static bool have_read_eof = false;
 
 /* Name of output files. */
-static char * volatile filename_space = NULL;
+static char *volatile filename_space = NULL;
 
 /* Prefix part of output file names. */
-static char volatile prefix = NULL;
+static char const *volatile prefix = NULL;
 
 /* Suffix part of output file names. */
-static char * volatile suffix = NULL;
+static char *volatile suffix = NULL;
 
 /* Number of digits to use in output file names. */
 static int volatile digits = 2;
index 43eecb9dda494c1f3943405b576117d1fbcbb12c..4faae4c5031e1a32495d52a9cd5d663369769184 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -1,5 +1,5 @@
 /* cut - remove parts of lines of files
-   Copyright (C) 1997-2005 Free Software Foundation, Inc.
+   Copyright (C) 1997-2006 Free Software Foundation, Inc.
    Copyright (C) 1984 David M. Ihnat
 
    This program is free software; you can redistribute it and/or modify
@@ -702,7 +702,7 @@ cut_stream (FILE *stream)
    Return true if successful.  */
 
 static bool
-cut_file (char *file)
+cut_file (char const *file)
 {
   FILE *stream;
 
index fc9319b60ed5b0b546a429e4b9c818daa53d6222..cf6e2a9c8806bb47ae0532ffdaf574959c1a1bf5 100644 (file)
@@ -246,7 +246,7 @@ dc_parse_stream (FILE *fp, const char *filename)
   char *input_line = NULL;
   size_t input_line_size = 0;
   char const *line;
-  char *term;
+  char const *term;
   bool ok = true;
 
   /* State for the parser.  */
index 99bbdd8fd4766409aabca10d8ca2fd2ce24f996a..7f9f5323db7114d129c513073bee84a640e9319d 100644 (file)
@@ -236,7 +236,7 @@ int_value (intmax_t i)
 /* Return a VALUE for S.  */
 
 static VALUE *
-str_value (char *s)
+str_value (char const *s)
 {
   VALUE *v = xmalloc (sizeof *v);
   v->type = string;
index cef98c1a8122c5470b2498b096f08e3c3702828e..0d4ea586086fb1e00b56351ceaecf6294248c082 100644 (file)
@@ -1,5 +1,5 @@
 /* fold -- wrap each input line to fit in specified width.
-   Copyright (C) 91, 1995-2005 Free Software Foundation, Inc.
+   Copyright (C) 91, 1995-2006 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
@@ -122,7 +122,7 @@ adjust_column (size_t column, char c)
    Return true if successful.  */
 
 static bool
-fold_file (char *filename, size_t width)
+fold_file (char const *filename, size_t width)
 {
   FILE *istream;
   int c;
index 7ee57b77d60e20901b9f4f6cf358427dc1a3a3b2..e8502a8ce7e939079e455a118da615a4860cff31 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -64,16 +64,16 @@ enum section
 char *program_name;
 
 /* Format of body lines (-b).  */
-static char *body_type = "t";
+static char const *body_type = "t";
 
 /* Format of header lines (-h).  */
-static char *header_type = "n";
+static char const *header_type = "n";
 
 /* Format of footer lines (-f).  */
-static char *footer_type = "n";
+static char const *footer_type = "n";
 
 /* Format currently being used (body, header, or footer).  */
-static char *current_type;
+static char const *current_type;
 
 /* Regex for body lines to number (-bp).  */
 static struct re_pattern_buffer body_regex;
@@ -93,7 +93,7 @@ static char footer_fastmap[UCHAR_MAX + 1];
 static struct re_pattern_buffer *current_regex = NULL;
 
 /* Separator string to print after line number (-s).  */
-static char *separator_str = "\t";
+static char const *separator_str = "\t";
 
 /* Input section delimiter string (-d).  */
 static char const *section_del = DEFAULT_SECTION_DELIMITERS;
@@ -235,9 +235,10 @@ FORMAT is one of:\n\
    according to `optarg'.  */
 
 static bool
-build_type_arg (char **typep, struct re_pattern_buffer *regexp, char *fastmap)
+build_type_arg (char const **typep,
+               struct re_pattern_buffer *regexp, char *fastmap)
 {
-  const char *errmsg;
+  char const *errmsg;
   bool rval = true;
 
   switch (*optarg)
@@ -414,7 +415,7 @@ process_file (FILE *fp)
    Return true if successful.  */
 
 static bool
-nl_file (const char *file)
+nl_file (char const *file)
 {
   FILE *stream;
 
index 1903bcd64702406de9ebe0dc2fedd3e9bd1a59a4..414fb8830322444f7e9a6f21c021565ba66c68c7 100644 (file)
@@ -463,9 +463,7 @@ main (int argc, char **argv)
        {
        case 'd':
          /* Delimiter character(s). */
-         if (optarg[0] == '\0')
-           optarg = "\\0";
-         delim_arg = optarg;
+         delim_arg = (optarg[0] == '\0' ? "\\0" : optarg);
          break;
 
        case 's':
index 0967588885d53b029948d012043dbd2a9c5ae8d6..bd694f49f5ea0a96f44aac2420a5e029cead23c1 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -430,7 +430,7 @@ static void getoptarg (char *arg, char switch_char, char *character,
 void usage (int status);
 static void print_files (int number_of_files, char **av);
 static void init_parameters (int number_of_files);
-static void init_header (char *filename, int desc);
+static void init_header (char const *filename, int desc);
 static bool init_fps (int number_of_files, char **av);
 static void init_funcs (void);
 static void init_store_cols (void);
@@ -1653,7 +1653,7 @@ print_files (int number_of_files, char **av)
    FILENAME for reading.  */
 
 static void
-init_header (char *filename, int desc)
+init_header (char const *filename, int desc)
 {
   char *buf = NULL;
   struct stat st;
index bfb40728c9b5ca83fe67bdbca54bdb96b8906a29..43fe5baf5490fab3dc415f9aa162b75e5b057c75 100644 (file)
@@ -76,7 +76,7 @@ static bool posixly_correct;
 
 /* This message appears in N_() here rather than just in _() below because
    the sole use would have been in a #define.  */
-static char *const cfcc_msg =
+static char const *const cfcc_msg =
  N_("warning: %s: character(s) following character constant have been ignored");
 
 /* The name this program was run with. */
index b3777b21aec6775b3f07e120e9ad797bce96fb8f..dc166aaa3dfb64765a4b49e2d10e27d22932d725 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -78,7 +78,7 @@ tac -r -s '.\|
 char *program_name;
 
 /* The string that separates the records of the file. */
-static char *separator;
+static char const *separator;
 
 /* True if we have ever read standard input.  */
 static bool have_read_stdin = false;
@@ -211,7 +211,7 @@ tac_seekable (int input_fd, const char *file)
      Only used when the separator is attached to the preceding record. */
   bool first_time = true;
   char first_char = *separator;        /* Speed optimization, non-regexp. */
-  char *separator1 = separator + 1; /* Speed optimization, non-regexp. */
+  char const *separator1 = separator + 1; /* Speed optimization, non-regexp. */
   size_t match_length1 = match_length - 1; /* Speed optimization, non-regexp. */
   struct re_registers regs;
 
@@ -426,7 +426,7 @@ static bool
 copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
 {
   static char *template = NULL;
-  static char *tempdir;
+  static char const *tempdir;
   char *tempfile;
   FILE *tmp;
   int fd;
index 7d8f421e6458204230485f41c415ab383198b008..d17f40a9adb0f9200c24e2c160115ce5b3d15f4e 100644 (file)
@@ -292,7 +292,7 @@ valid_file_spec (struct File_spec const *f)
   return ((f->fd == -1) ^ (f->errnum == 0));
 }
 
-static char *
+static char const *
 pretty_name (struct File_spec const *f)
 {
   return (STREQ (f->name, "-") ? "standard input" : f->name);
index e18e5588ee9b271f175010e8c8ff4374e763418c..214eb2bc97cde6f28f49933979109ce388842c37 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -601,7 +601,7 @@ make_printable_str (char const *s, size_t len)
   for (i = 0; i < len; i++)
     {
       char buf[5];
-      char *tmp = NULL;
+      char const *tmp = NULL;
       unsigned char c = s[i];
 
       switch (c)