bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Suggestion for more const - patch included


From: Stephan Springl
Subject: [Bug-tar] Suggestion for more const - patch included
Date: Wed, 25 Apr 2007 09:11:30 +0200 (MSZ)

Hi there,

while adding a local extension to tar options, I found that the array of option descriptions could (and should?) actually be const. If you agree, feel free to use the patch below. Copyright assignment is probably not neccessary for such a small modification.

     Thanks for your work on GNU tar.

Stephan

commit 5d88541984990007b9e4f7f3e60877716b09920c
Author: Stephan Springl <address@hidden>
Date:   Wed Apr 25 08:37:21 2007 +0200

    options const

diff --git a/src/tar.c b/src/tar.c
index 35121ff..16ba826 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -354,7 +354,7 @@ The version control may be set with --ba
    y  per-file gzip compression
    Y  per-block gzip compression */

-static struct argp_option options[] = {
+static const struct argp_option options[] = {
 #define GRID 10
   {NULL, 0, NULL, 0,
    N_("Main operation mode:"), GRID },
@@ -1899,8 +1899,8 @@ usage (int status)

 /* Parse the options for tar.  */

-static struct argp_option *
-find_argp_option (struct argp_option *options, int letter)
+static const struct argp_option *
+find_argp_option (const struct argp_option *options, int letter)
 {
   for (;
        !(options->name == NULL
@@ -1975,7 +1975,7 @@ decode_options (int argc, char **argv)

       for (letter = *in++; *letter; letter++)
        {
-         struct argp_option *opt;
+         const struct argp_option *opt;

          buffer[1] = *letter;
          *out++ = xstrdup (buffer);
--
Stephan Springl                           BFW Werner Völk GmbH
address@hidden                 Energiemesstechnik & Service
+49 89 82917-452                          Drosselgasse 5
                                          82166 Gräfelfing/München

reply via email to

[Prev in Thread] Current Thread [Next in Thread]