Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1742993 > unrolled thread
| Started by | Harsha Sharma <harshasharmaiitr@gmail.com> |
|---|---|
| First post | 2017-10-02 09:40 +0200 |
| Last post | 2017-10-02 09:40 +0200 |
| Articles | 4 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/3] evaluate: Follow linux-kernel coding style Harsha Sharma <harshasharmaiitr@gmail.com> - 2017-10-02 09:40 +0200
[PATCH 3/3] evaluate: make pointers in string arrays constant Harsha Sharma <harshasharmaiitr@gmail.com> - 2017-10-02 09:40 +0200
[PATCH 2/3] evaluate: Place constant on right side in comparison Harsha Sharma <harshasharmaiitr@gmail.com> - 2017-10-02 09:40 +0200
[PATCH 1/3] evaluate: Remove unnecessary spaces Harsha Sharma <harshasharmaiitr@gmail.com> - 2017-10-02 09:40 +0200
| From | Harsha Sharma <harshasharmaiitr@gmail.com> |
|---|---|
| Date | 2017-10-02 09:40 +0200 |
| Subject | [PATCH 0/3] evaluate: Follow linux-kernel coding style |
| Message-ID | <uw3ux-4tG-1@gated-at.bofh.it> |
Issues found using checkpatch.pl As per linux-kernel coding style, code indent should use tabs wherever possible and avoid unnecessary spaces. Comparisons shoukd place the constant on the right side of the test. static const char * array should be static const * char const array Harsha Sharma (3): evaluate: Remove unnecessary spaces evaluate: Place constant on right side in comparison evaluate: fix checkpatch issue for static const char * array src/evaluate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 1.9.1
[toc] | [next] | [standalone]
| From | Harsha Sharma <harshasharmaiitr@gmail.com> |
|---|---|
| Date | 2017-10-02 09:40 +0200 |
| Subject | [PATCH 3/3] evaluate: make pointers in string arrays constant |
| Message-ID | <uw3uy-4tG-11@gated-at.bofh.it> |
| In reply to | #1742993 |
static const char * array should probably be static const char * const
array
as per linux-kernel coding style
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
src/evaluate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/evaluate.c b/src/evaluate.c
index b783054..f48801a 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -33,7 +33,7 @@
static struct output_ctx octx_debug_dummy;
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",
@@ -3350,7 +3350,7 @@ static int cmd_evaluate_export(struct eval_ctx *ctx, struct cmd *cmd)
ctx->debug_mask & DEBUG_NETLINK);
}
-static const char *cmd_op_name[] = {
+static const char * const cmd_op_name[] = {
[CMD_INVALID] = "invalid",
[CMD_ADD] = "add",
[CMD_REPLACE] = "replace",
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Harsha Sharma <harshasharmaiitr@gmail.com> |
|---|---|
| Date | 2017-10-02 09:40 +0200 |
| Subject | [PATCH 2/3] evaluate: Place constant on right side in comparison |
| Message-ID | <uw3uy-4tG-15@gated-at.bofh.it> |
| In reply to | #1742993 |
Comparisons should place the constant on the right side of the test
as per linux-kernel coding style
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
src/evaluate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/evaluate.c b/src/evaluate.c
index 5624ca2..b783054 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2174,13 +2174,13 @@ static int stmt_evaluate_reject_bridge_family(struct eval_ctx *ctx,
protocol = proto_find_num(base, desc);
switch (protocol) {
case __constant_htons(ETH_P_IP):
- if (NFPROTO_IPV4 == stmt->reject.family)
+ if (stmt->reject.family == NFPROTO_IPV4)
break;
return stmt_binary_error(ctx, stmt->reject.expr,
&ctx->pctx.protocol[PROTO_BASE_NETWORK_HDR],
"conflicting protocols specified: ip vs ip6");
case __constant_htons(ETH_P_IPV6):
- if (NFPROTO_IPV6 == stmt->reject.family)
+ if (stmt->reject.family == NFPROTO_IPV6)
break;
return stmt_binary_error(ctx, stmt->reject.expr,
&ctx->pctx.protocol[PROTO_BASE_NETWORK_HDR],
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Harsha Sharma <harshasharmaiitr@gmail.com> |
|---|---|
| Date | 2017-10-02 09:40 +0200 |
| Subject | [PATCH 1/3] evaluate: Remove unnecessary spaces |
| Message-ID | <uw3uy-4tG-19@gated-at.bofh.it> |
| In reply to | #1742993 |
Code indent should use tabs wherever possible Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com> --- src/evaluate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/evaluate.c b/src/evaluate.c index e767542..5624ca2 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -122,7 +122,7 @@ static int byteorder_conversion(struct eval_ctx *ctx, struct expr **expr, return 0; if (expr_basetype(*expr)->type != TYPE_INTEGER) return expr_error(ctx->msgs, *expr, - "Byteorder mismatch: expected %s, got %s", + "Byteorder mismatch: expected %s, got %s", byteorder_names[byteorder], byteorder_names[(*expr)->byteorder]); @@ -1321,7 +1321,7 @@ static int expr_evaluate_hash(struct eval_ctx *ctx, struct expr **exprp) return -1; /* expr_evaluate_primary() sets the context to what to the input - * expression to be hashed. Since this input is transformed to a 4 bytes + * expression to be hashed. Since this input is transformed to a 4 bytes * integer, restore context to the datatype that results from hashing. */ __expr_set_context(&ctx->ectx, expr->dtype, expr->byteorder, expr->len, @@ -1627,7 +1627,7 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr) case EXPR_CONCAT: return expr_binary_error(ctx->msgs, left, rel, "Relational expression (%s) is undefined " - "for %s expressions", + "for %s expressions", expr_op_symbols[rel->op], left->ops->name); default: @@ -1637,7 +1637,7 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr) if (!expr_is_singleton(right)) return expr_binary_error(ctx->msgs, right, rel, "Relational expression (%s) is undefined " - "for %s expressions", + "for %s expressions", expr_op_symbols[rel->op], right->ops->name); @@ -1659,7 +1659,7 @@ range: case EXPR_CONCAT: return expr_binary_error(ctx->msgs, left, rel, "Relational expression (%s) is undefined" - "for %s expressions", + "for %s expressions", expr_op_symbols[rel->op], left->ops->name); default: -- 1.9.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web