[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] constify a few more read-only data structures
From: |
Mike Frysinger |
Subject: |
[PATCH] constify a few more read-only data structures |
Date: |
Thu, 4 Nov 2021 01:02:58 -0400 |
* buffer.c (zip_program): Add const.
* names.c (names_options): Add const.
(file_selection_option): Add const to p.
* suffix.c (compression_suffixes): Add const.
(find_compression_suffix): Add const to p.
* tar.c (options, sort_mode_flag, argp_children, argp): Add const.
(find_argp_option): Add const to ap.
---
src/buffer.c | 2 +-
src/names.c | 4 ++--
src/suffix.c | 4 ++--
src/tar.c | 10 +++++-----
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/buffer.c b/src/buffer.c
index 433cb594ba5c..955844641515 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -316,7 +316,7 @@ static struct zip_magic const magic[] = {
#define NMAGIC (sizeof(magic)/sizeof(magic[0]))
-static struct zip_program zip_program[] = {
+static struct zip_program const zip_program[] = {
{ ct_compress, COMPRESS_PROGRAM, "-Z" },
{ ct_compress, GZIP_PROGRAM, "-z" },
{ ct_gzip, GZIP_PROGRAM, "-z" },
diff --git a/src/names.c b/src/names.c
index 7773163c92db..33a029d25683 100644
--- a/src/names.c
+++ b/src/names.c
@@ -70,7 +70,7 @@ enum
GRID_MATCH,
};
-static struct argp_option names_options[] = {
+static struct argp_option const names_options[] = {
{NULL, 0, NULL, 0,
N_("Local file name selection:"), GRH_LOCAL },
@@ -156,7 +156,7 @@ static struct argp_option names_options[] = {
static struct argp_option const *
file_selection_option (int key)
{
- struct argp_option *p;
+ struct argp_option const *p;
for (p = names_options;
!(p->name == NULL && p->key == 0 && p->doc == NULL); p++)
diff --git a/src/suffix.c b/src/suffix.c
index 1259e080aedb..c509377cf2b6 100644
--- a/src/suffix.c
+++ b/src/suffix.c
@@ -26,7 +26,7 @@ struct compression_suffix
const char *program;
};
-static struct compression_suffix compression_suffixes[] = {
+static struct compression_suffix const compression_suffixes[] = {
#define __CAT2__(a,b) a ## b
#define S(s,p) #s, sizeof (#s) - 1, __CAT2__(p,_PROGRAM)
{ "tar", 3, NULL },
@@ -60,7 +60,7 @@ find_compression_suffix (const char *name, size_t *ret_len)
if (suf)
{
size_t len;
- struct compression_suffix *p;
+ struct compression_suffix const *p;
suf++;
len = strlen (suf);
diff --git a/src/tar.c b/src/tar.c
index de85d4ba8697..69c4779cc062 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -441,7 +441,7 @@ enum
GRID_OTHER /* Other options */
};
-static struct argp_option options[] = {
+static struct argp_option const options[] = {
{NULL, 0, NULL, 0,
N_("Main operation mode:"), GRH_COMMAND },
@@ -1299,7 +1299,7 @@ static char const *const sort_mode_arg[] = {
NULL
};
-static int sort_mode_flag[] = {
+static int const sort_mode_flag[] = {
SAVEDIR_SORT_NONE,
SAVEDIR_SORT_NAME,
#if D_INO_IN_DIRENT
@@ -2128,12 +2128,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
}
extern struct argp names_argp;
-static struct argp_child argp_children[] = {
+static struct argp_child const argp_children[] = {
{ &names_argp, 0, NULL, GRID_FILE_NAME },
{ NULL }
};
-static struct argp argp = {
+static struct argp const argp = {
options,
parse_opt,
N_("[FILE]..."),
@@ -2168,7 +2168,7 @@ find_argp_option_key (struct argp_option const *o, int
key)
}
static struct argp_option const *
-find_argp_option (struct argp *ap, int key)
+find_argp_option (struct argp const *ap, int key)
{
struct argp_option const *p = NULL;
struct argp_child const *child;
--
2.33.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] constify a few more read-only data structures,
Mike Frysinger <=