Re: [PATCH 1/6] netfilter: xtables: replace XT_ENTRY_ITERATE macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Engelhardt wrote:
On Saturday 2010-02-13 11:29, Amos Jeffries wrote:
Jan Engelhardt wrote:
The macro is replaced by a list.h-like foreach loop. This makes
the code much more inspectable.

<snip>
	if (IS_ERR(counters))
@@ -1967,9 +2009,12 @@ compat_copy_entries_to_user(unsigned int total_size,
struct xt_table *table,
	loc_cpu_entry = private->entries[raw_smp_processor_id()];
	pos = userptr;
	size = total_size;
-	ret = IP6T_ENTRY_ITERATE(loc_cpu_entry, total_size,
-				 compat_copy_entry_to_user,
-				 &pos, &size, counters, &i);
+	xt_entry_foreach(iter, loc_cpu_entry, total_size) {
+		ret = compat_copy_entry_to_user(iter, &pos,
+		      &size, counters, &i);
+		if (ret != 0)
+			break;
+	}

<snip>

	loc_cpu_entry = private->entries[raw_smp_processor_id()];
-	IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, net,
NULL);
+	xt_entry_foreach(iter, loc_cpu_entry, private->size)
+		if (cleanup_entry(iter, net, NULL) != 0)
+			break;
	if (private->number > private->initial_entries)
		module_put(table_owner);
	xt_free_table_info(private);
Just my 2c, but you seem to be floating between several coding styles on this
one.

What, where? It goes by two simple rules:
- no assignments in if()
- only use {} where needed


Oh I see. ret being used later. nevermind.

AYJ
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux