All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iptables: libiptc: Use list_{next/prev}_entry instead of list_entry
@ 2017-03-29  6:12 simran singhal
  2017-04-07 15:34 ` [Outreachy kernel] " Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: simran singhal @ 2017-03-29  6:12 UTC (permalink / raw)
  To: netfilter-devel; +Cc: outreachy-kernel

This patch replace list_entry with list_{next/prev}_entry as it makes
the code more clear to read.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 libiptc/libiptc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index a6e7057..5590cb8 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -1452,7 +1452,7 @@ static void iptcc_chain_iterator_advance(struct xtc_handle *handle)
 		handle->chain_iterator_cur = NULL;
 	else
 		handle->chain_iterator_cur =
-			list_entry(c->list.next, struct chain_head, list);
+			list_next_entry(c, list);
 }
 
 /* Iterator functions to run through the chains. */
@@ -1540,8 +1540,7 @@ TC_NEXT_RULE(const STRUCT_ENTRY *prev, struct xtc_handle *handle)
 		return NULL;
 	}
 
-	r = list_entry(handle->rule_iterator_cur->list.next,
-			struct rule_head, list);
+	r = list_next_entry(handle->rule_iterator_cur, list);
 
 	iptc_fn = TC_NEXT_RULE;
 
@@ -2013,8 +2012,8 @@ static int delete_entry(const IPT_CHAINLABEL chain, const STRUCT_ENTRY *origfw,
 		 * pointer will then point to real next node */
 		if (i == handle->rule_iterator_cur) {
 			handle->rule_iterator_cur =
-				list_entry(handle->rule_iterator_cur->list.prev,
-					   struct rule_head, list);
+				list_prev_entry(handle->rule_iterator_cur,
+						list);
 		}
 
 		c->num_rules--;
@@ -2078,8 +2077,7 @@ TC_DELETE_NUM_ENTRY(const IPT_CHAINLABEL chain,
 	 * point to real next node */
 	if (r == handle->rule_iterator_cur) {
 		handle->rule_iterator_cur =
-			list_entry(handle->rule_iterator_cur->list.prev,
-				   struct rule_head, list);
+			list_prev_entry(handle->rule_iterator_cur, list);
 	}
 
 	c->num_rules--;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH] iptables: libiptc: Use list_{next/prev}_entry instead of list_entry
  2017-03-29  6:12 [PATCH] iptables: libiptc: Use list_{next/prev}_entry instead of list_entry simran singhal
@ 2017-04-07 15:34 ` Pablo Neira Ayuso
  2017-04-07 15:55   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-04-07 15:34 UTC (permalink / raw)
  To: simran singhal; +Cc: netfilter-devel, outreachy-kernel

On Wed, Mar 29, 2017 at 11:42:19AM +0530, simran singhal wrote:
> This patch replace list_entry with list_{next/prev}_entry as it makes
> the code more clear to read.

Applied, thanks.

I think you can send a similar patch for libnftnl.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH] iptables: libiptc: Use list_{next/prev}_entry instead of list_entry
  2017-04-07 15:34 ` [Outreachy kernel] " Pablo Neira Ayuso
@ 2017-04-07 15:55   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-04-07 15:55 UTC (permalink / raw)
  To: simran singhal; +Cc: netfilter-devel, outreachy-kernel

On Fri, Apr 07, 2017 at 05:34:37PM +0200, Pablo Neira Ayuso wrote:
> On Wed, Mar 29, 2017 at 11:42:19AM +0530, simran singhal wrote:
> > This patch replace list_entry with list_{next/prev}_entry as it makes
> > the code more clear to read.
> 
> Applied, thanks.
> 
> I think you can send a similar patch for libnftnl.

Actually I had to keep it back. This doesn't even compile, please test
your patches.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-07 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-29  6:12 [PATCH] iptables: libiptc: Use list_{next/prev}_entry instead of list_entry simran singhal
2017-04-07 15:34 ` [Outreachy kernel] " Pablo Neira Ayuso
2017-04-07 15:55   ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.