From: Harsha Sharma <harshasharmaiitr@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org,
outreachy-kernel@googlegroups.com,
Harsha Sharma <harshasharmaiitr@gmail.com>
Subject: [PATCH v2] nftables: make pointers in string arrays constant
Date: Fri, 6 Oct 2017 20:17:54 +0530 [thread overview]
Message-ID: <20171006144754.17362-1-harshasharmaiitr@gmail.com> (raw)
Static const char * array should be static const char *
const array as per linux-kernel coding style
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
Changes in v2:e
-rebase against current tree and solve merge confilcts
-Change log message
src/erec.c | 2 +-
src/evaluate.c | 4 ++--
src/rule.c | 6 +++---
src/statement.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/erec.c b/src/erec.c
index 76fdeb8..80806ff 100644
--- a/src/erec.c
+++ b/src/erec.c
@@ -27,7 +27,7 @@ const struct location internal_location = {
.indesc = &internal_indesc,
};
-static const char *error_record_names[] = {
+static const char * const error_record_names[] = {
[EREC_INFORMATIONAL] = NULL,
[EREC_WARNING] = "Warning",
[EREC_ERROR] = "Error"
diff --git a/src/evaluate.c b/src/evaluate.c
index 193ea1c..618e188 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -32,7 +32,7 @@
static int expr_evaluate(struct eval_ctx *ctx, struct expr **expr);
-static const char *byteorder_names[] = {
+static const char * const byteorder_names[] = {
[BYTEORDER_INVALID] = "invalid",
[BYTEORDER_HOST_ENDIAN] = "host endian",
[BYTEORDER_BIG_ENDIAN] = "big endian",
@@ -3423,7 +3423,7 @@ static int cmd_evaluate_export(struct eval_ctx *ctx, struct cmd *cmd)
ctx->debug_mask & DEBUG_NETLINK, ctx->octx);
}
-static const char *cmd_op_name[] = {
+static const char * const cmd_op_name[] = {
[CMD_INVALID] = "invalid",
[CMD_ADD] = "add",
[CMD_REPLACE] = "replace",
diff --git a/src/rule.c b/src/rule.c
index 67a828f..d744cf6 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -496,7 +496,7 @@ struct symbol *symbol_lookup(const struct scope *scope, const char *identifier)
return NULL;
}
-static const char *chain_type_str_array[] = {
+static const char * const chain_type_str_array[] = {
"filter",
"nat",
"route",
@@ -515,7 +515,7 @@ const char *chain_type_name_lookup(const char *name)
return NULL;
}
-static const char *chain_hookname_str_array[] = {
+static const char * const chain_hookname_str_array[] = {
"prerouting",
"input",
"forward",
@@ -1345,7 +1345,7 @@ static void obj_print_data(const struct obj *obj,
}
}
-static const char *obj_type_name_array[] = {
+static const char * const obj_type_name_array[] = {
[NFT_OBJECT_COUNTER] = "counter",
[NFT_OBJECT_QUOTA] = "quota",
[NFT_OBJECT_CT_HELPER] = "",
diff --git a/src/statement.c b/src/statement.c
index 6166863..11d067f 100644
--- a/src/statement.c
+++ b/src/statement.c
@@ -302,7 +302,7 @@ const char *get_unit(uint64_t u)
return "error";
}
-static const char *data_unit[] = {
+static const char * const data_unit[] = {
"bytes",
"kbytes",
"mbytes",
@@ -496,7 +496,7 @@ static void print_nf_nat_flags(uint32_t flags, struct output_ctx *octx)
static void nat_stmt_print(const struct stmt *stmt, struct output_ctx *octx)
{
- static const char *nat_types[] = {
+ static const char * const nat_types[] = {
[NFT_NAT_SNAT] = "snat",
[NFT_NAT_DNAT] = "dnat",
};
--
2.11.0
next reply other threads:[~2017-10-06 14:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 14:47 Harsha Sharma [this message]
2017-10-09 13:28 ` [PATCH v2] nftables: make pointers in string arrays constant Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171006144754.17362-1-harshasharmaiitr@gmail.com \
--to=harshasharmaiitr@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).