* [PATCH 1/3] evaluate: Remove unnecessary spaces
2017-10-02 7:32 [PATCH 0/3] evaluate: Follow linux-kernel coding style Harsha Sharma
@ 2017-10-02 7:32 ` Harsha Sharma
2017-10-02 7:32 ` [PATCH 2/3] evaluate: Place constant on right side in comparison Harsha Sharma
2017-10-02 7:32 ` [PATCH 3/3] evaluate: make pointers in string arrays constant Harsha Sharma
2 siblings, 0 replies; 5+ messages in thread
From: Harsha Sharma @ 2017-10-02 7:32 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, linux-kernel, outreachy-kernel, Harsha Sharma
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] evaluate: Place constant on right side in comparison
2017-10-02 7:32 [PATCH 0/3] evaluate: Follow linux-kernel coding style Harsha Sharma
2017-10-02 7:32 ` [PATCH 1/3] evaluate: Remove unnecessary spaces Harsha Sharma
@ 2017-10-02 7:32 ` Harsha Sharma
2017-10-02 7:32 ` [PATCH 3/3] evaluate: make pointers in string arrays constant Harsha Sharma
2 siblings, 0 replies; 5+ messages in thread
From: Harsha Sharma @ 2017-10-02 7:32 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, linux-kernel, outreachy-kernel, Harsha Sharma
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] evaluate: make pointers in string arrays constant
2017-10-02 7:32 [PATCH 0/3] evaluate: Follow linux-kernel coding style Harsha Sharma
2017-10-02 7:32 ` [PATCH 1/3] evaluate: Remove unnecessary spaces Harsha Sharma
2017-10-02 7:32 ` [PATCH 2/3] evaluate: Place constant on right side in comparison Harsha Sharma
@ 2017-10-02 7:32 ` Harsha Sharma
2017-10-04 14:29 ` [Outreachy kernel] " Pablo Neira Ayuso
2 siblings, 1 reply; 5+ messages in thread
From: Harsha Sharma @ 2017-10-02 7:32 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, linux-kernel, outreachy-kernel, Harsha Sharma
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
^ permalink raw reply related [flat|nested] 5+ messages in thread