On Saturday 12 May 2012 13:56:55 Antonio Quartulli wrote:
On Sat, May 12, 2012 at 01:48:52 +0200, Sven Eckelmann wrote:
hash_ipv4 is only used in distributed-arp-table.c and therefore can be placed inside this file instead of the header.
Signed-off-by: Sven Eckelmann sven@narfation.org
distributed-arp-table.c | 24 +++++++++++++++++++++++- distributed-arp-table.h | 22 ---------------------- 2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/distributed-arp-table.c b/distributed-arp-table.c index e678ec4..4894a85 100644 --- a/distributed-arp-table.c +++ b/distributed-arp-table.c @@ -32,6 +32,28 @@
#include "translation-table.h" #include "unicast.h"
+/* hash function to choose an entry in a hash table of given size.
- hash algorithm from http://en.wikipedia.org/wiki/Hash_table
- */
+static uint32_t batadv_hash_ipv4(const void *data, uint32_t size)
since the function is static, why do we want to use the batadv prefix? would this create confusion?
Consistent naming scheme.
Just imagine that somebody needs some function like that in another file and don't want to move it to the header. That would mean that he removes the static and add a declaration in the header file.... and now we have the problem of the missing batadv_ prefix. Either he changes the name everywhere or creates those potential namespace problems.
So I would recommend to use the batadv_ prefix everywhere. Less problems in the future and maybe a happier David. :)
Kind regards, Sven